From: SecMeant Date: Mon, 29 Jun 2020 17:31:21 +0000 (+0200) Subject: Adding constexpr_to_string namespace X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=2717bb70eadf98411dee246de389668ea7033499;p=clyne%2Fconstexpr-to-string.git Adding constexpr_to_string namespace Namespace is used to prevent pollution of global namespace by digits and digits_count symbols. --- diff --git a/to_string.hpp b/to_string.hpp index 63b52ab..2ea6a60 100644 --- a/to_string.hpp +++ b/to_string.hpp @@ -9,6 +9,8 @@ #include +namespace constexpr_to_string { + constexpr char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; constexpr auto digit_count = sizeof(digits) / sizeof(digits[0]); @@ -68,10 +70,12 @@ class to_string_t { constexpr const auto end() const noexcept { return buf + size(); } }; +} // namespace constexpr_to_string + /** * Simplifies use of `to_string_t` from `to_string_t()` to `to_string`. */ template -constexpr to_string_t to_string; +constexpr constexpr_to_string::to_string_t to_string; #endif // TCSULLIVAN_TO_STRING_HPP_