tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
isspace.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2020 Tobias Hienzsch
3
4#ifndef TETL_CCTYPE_ISSPACE_HPP
5#define TETL_CCTYPE_ISSPACE_HPP
6
7namespace etl {
8
9/// \brief Checks if the given character is whitespace character as classified
10/// by the default C locale.
11///
12/// \param ch Character to classify.
13///
14/// \returns Non-zero value if the character is a whitespace character, zero
15/// otherwise.
16///
17/// https://en.cppreference.com/w/cpp/string/byte/isspace
18///
19/// \ingroup cctype
20[[nodiscard]] constexpr auto isspace(int ch) noexcept -> int
21{
22 auto const sp = ch == ' ';
23 auto const form = ch == '\f';
24 auto const line = ch == '\n';
25 auto const carriage = ch == '\r';
26 auto const hTab = ch == '\t';
27 auto const vTab = ch == '\v';
28 return static_cast<int>(sp || form || line || carriage || hTab || vTab);
29}
30} // namespace etl
31
32#endif // TETL_CCTYPE_ISSPACE_HPP
constexpr auto isspace(int ch) noexcept -> int
Checks if the given character is whitespace character as classified by the default C locale.
Definition isspace.hpp:20
Definition adjacent_find.hpp:9