repr 0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
util/string/util.h
Go to the documentation of this file.
1#pragma once
2#include <cstddef>
3#include <concepts>
4#include <string>
5
6namespace librepr::detail {
7template <typename T>
8concept string_like = requires(T& t) {
9 t.size();
10 { t.data() } -> std::convertible_to<const char*>;
11};
12
13template <std::size_t N>
14constexpr std::size_t strsize(const char(&)[N]) {
15 return (N - 1U);
16}
17
18constexpr std::size_t strsize(const char* str) {
20}
21
22template <string_like T>
23constexpr std::size_t strsize(T&& t) {
24 return t.size();
25}
26} // namespace librepr::detail
Definition util/string/util.h:8
T length(T... args)
Definition assert.h:89
constexpr std::size_t strsize(const char(&)[N])
Definition util/string/util.h:14
std::string code_for()
Definition repr:39