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
9
10namespace 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
#define TETL_PRECONDITION(...)
Definition check.hpp:16
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
Definition adjacent_find.hpp:8