tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
strchr.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_CSTRING_STRCHR_HPP
4
#define TETL_CSTRING_STRCHR_HPP
5
6
#include <
etl/_contracts/check.hpp
>
7
#include <
etl/_cstddef/size_t.hpp
>
8
#include <
etl/_strings/cstr.hpp
>
9
10
namespace
etl
{
11
14
24
[[nodiscard]]
constexpr
auto
strchr
(
char
const
* str,
int
ch) ->
char
const
*
25
{
26
TETL_PRECONDITION
(str !=
nullptr
);
27
#if defined(__clang__)
28
return
__builtin_strchr(str, ch);
29
#else
30
return
etl::detail::strchr<char const>(str, ch);
31
#endif
32
}
33
34
[[nodiscard]]
constexpr
auto
strchr
(
char
* str,
int
ch) ->
char
*
35
{
36
TETL_PRECONDITION
(str !=
nullptr
);
37
#if defined(__clang__)
38
return
__builtin_strchr(str, ch);
39
#else
40
return
etl::detail::strchr<char>(str, ch);
41
#endif
42
}
43
45
46
}
// namespace etl
47
48
#endif
// TETL_CSTRING_STRCHR_HPP
check.hpp
TETL_PRECONDITION
#define TETL_PRECONDITION(...)
Definition
check.hpp:16
cstr.hpp
etl::strchr
constexpr auto strchr(char const *str, int ch) -> char const *
Finds the first occurrence of the character static_cast<char>(ch) in the byte string pointed to by st...
Definition
strchr.hpp:24
etl
Definition
adjacent_find.hpp:8
size_t.hpp
include
etl
_cstring
strchr.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0