fixed_string: manually copy string data to avoid <algorithm>

This commit is contained in:
Danny Robson 2024-08-10 14:17:23 +10:00
parent 428e5c683d
commit 07dfd4ef3e

View File

@ -8,7 +8,7 @@
#pragma once #pragma once
#include <algorithm> #include <string_view>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -30,7 +30,8 @@ namespace cruft {
constexpr constexpr
fixed_string (char const _value[N+1]) noexcept fixed_string (char const _value[N+1]) noexcept
{ {
std::copy_n (_value, N, value); for (std::size_t i = 0; i <= N; ++i)
value[i] = _value[i];
} }
constexpr operator char const* () const { return value; } constexpr operator char const* () const { return value; }