tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
strcmp.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4
#
ifndef
TETL_CSTRING_STRCMP_HPP
5
#
define
TETL_CSTRING_STRCMP_HPP
6
7
#
include
<
etl
/
_cstddef
/
size_t
.
hpp
>
8
#
include
<
etl
/
_strings
/
cstr
.
hpp
>
9
10
namespace
etl
{
11
12
/// Compares the C string lhs to the C string rhs.
13
///
14
/// This function starts comparing the first character of each string.
15
/// If they are equal to each other, it continues with the following pairs until
16
/// the characters differ or until a terminating null-character is reached.
17
///
18
/// \ingroup cstring
19
[[
nodiscard
]]
constexpr
auto
strcmp
(
char
const
* lhs,
char
const
* rhs) ->
int
20
{
21
#
if
defined
(
__clang__
)
22
return
__builtin_strcmp(lhs, rhs);
23
#
else
24
return
etl::detail::strcmp<
char
>(lhs, rhs);
25
#
endif
26
}
27
28
}
// namespace etl
29
30
#
endif
// TETL_CSTRING_STRCMP_HPP
etl::strcmp
constexpr auto strcmp(char const *lhs, char const *rhs) -> int
Compares the C string lhs to the C string rhs.
Definition
strcmp.hpp:19
etl
Definition
adjacent_find.hpp:9
include
etl
_cstring
strcmp.hpp
Generated on Sun Sep 7 2025 19:14:54 for tetl by
1.9.8