From 7e844ef7739c523111437793e0795b3c8c2f3552 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 4 Nov 2019 06:30:22 +0000 Subject: [PATCH] Construction from a single character added to a fixed_string --- src/include/units/bits/fixed_string.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/include/units/bits/fixed_string.h b/src/include/units/bits/fixed_string.h index 719227a4..48e27e44 100644 --- a/src/include/units/bits/fixed_string.h +++ b/src/include/units/bits/fixed_string.h @@ -31,6 +31,11 @@ namespace units { struct basic_fixed_string { CharT data_[N + 1] = {}; + constexpr basic_fixed_string(CharT ch) noexcept + { + data_[0] = ch; + } + constexpr basic_fixed_string(const CharT (&txt)[N + 1]) noexcept { for(std::size_t i = 0; i < N; ++i) @@ -97,6 +102,9 @@ namespace units { template basic_fixed_string(const CharT (&str)[N]) -> basic_fixed_string; + template + basic_fixed_string(CharT) -> basic_fixed_string; + template using fixed_string = basic_fixed_string;