tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
strlen.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_CSTRING_STRLEN_HPP
5#define TETL_CSTRING_STRLEN_HPP
6
7#include <etl/_cstddef/size_t.hpp>
8#include <etl/_strings/cstr.hpp>
9
10namespace etl {
11
12/// Returns the length of the C string str.
13/// \ingroup cstring
14[[nodiscard]] constexpr auto strlen(char const* str) -> etl::size_t
15{
16#if defined(__clang__)
17 return __builtin_strlen(str);
18#else
19 return etl::detail::strlen<char, etl::size_t>(str);
20#endif
21}
22
23} // namespace etl
24
25#endif // TETL_CSTRING_STRLEN_HPP
constexpr auto strlen(char const *str) -> etl::size_t
Returns the length of the C string str.
Definition strlen.hpp:14
Definition adjacent_find.hpp:9