tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
ispunct.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_ISPUNCT_HPP
5
#
define
TETL_CCTYPE_ISPUNCT_HPP
6
7
namespace
etl
{
8
9
/// \brief Checks if the given character is a punctuation character as
10
/// classified by the current C locale.
11
///
12
/// The default C locale classifies the characters
13
/// !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ as punctuation.
14
///
15
/// \param ch Character to classify.
16
///
17
/// \returns Non-zero value if the character is a punctuation character, zero
18
/// otherwise.
19
///
20
/// https://en.cppreference.com/w/cpp/string/byte/ispunct
21
///
22
/// \ingroup cctype
23
[[
nodiscard
]]
constexpr
auto
ispunct
(
int
ch)
noexcept
->
int
24
{
25
auto
const
sec1 = ch >=
'!'
and
ch <=
'/'
;
26
auto
const
sec2 = ch >=
':'
and
ch <=
'@'
;
27
auto
const
sec3 = ch >=
'['
and
ch <=
'`'
;
28
auto
const
sec4 = ch >=
'{'
and
ch <=
'~'
;
29
30
return
static_cast
<
int
>(sec1 || sec2 || sec3 || sec4);
31
}
32
}
// namespace etl
33
34
#
endif
// TETL_CCTYPE_ISPUNCT_HPP
etl::ispunct
constexpr auto ispunct(int ch) noexcept -> int
Checks if the given character is a punctuation character as classified by the current C locale.
Definition
ispunct.hpp:23
etl
Definition
adjacent_find.hpp:9
include
etl
_cctype
ispunct.hpp
Generated on Sun Sep 7 2025 19:14:48 for tetl by
1.9.8