xieite::str_size()

Defined in fragment xieite:str_size
(header-only: <xieite/str/str_size.hpp>)


A constexpr wrapper for std::strlen.


Declaration

#0
template<xieite::is_ch Ch>
[[nodiscard]] constexpr std::size_t str_size(Ch* str) noexcept;
Invokes undefined behavior if the passed string is not null-terminated.

#1
template<xieite::is_ch Ch, std::size_t size>
[[nodiscard]] constexpr std::size_t str_size(Ch(&)[size]) noexcept;
Returns size.


Example

import xieite;

int main() {
	xieite::dump(xieite::str_size("abcdef"));
}
Output:
6