tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
iswpunct.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_CWCTYPE_ISWPUNCT_HPP
5#define TETL_CWCTYPE_ISWPUNCT_HPP
6
7#include <etl/_cwchar/wint_t.hpp>
8
9namespace etl {
10
11/// \brief Checks if the given wide character is a punctuation character, i.e.
12/// it is one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ or any punctuation character
13/// specific to the current locale.
14///
15/// \details If the value of ch is neither representable as a wchar_t nor equal
16/// to the value of the macro WEOF, the behavior is undefined.
17///
18/// https://en.cppreference.com/w/cpp/string/wide/iswpunct
19///
20/// \ingroup cwctype
21[[nodiscard]] constexpr auto iswpunct(wint_t ch) noexcept -> int
22{
23 auto const sec1 = ch >= L'!' and ch <= L'/';
24 auto const sec2 = ch >= L':' and ch <= L'@';
25 auto const sec3 = ch >= L'[' and ch <= L'`';
26 auto const sec4 = ch >= L'{' and ch <= L'~';
27 return static_cast<int>(sec1 || sec2 || sec3 || sec4);
28}
29} // namespace etl
30
31#endif // TETL_CWCTYPE_ISWPUNCT_HPP
constexpr auto iswpunct(wint_t ch) noexcept -> int
Checks if the given wide character is a punctuation character, i.e. it is one of !...
Definition iswpunct.hpp:21
Definition adjacent_find.hpp:9