aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSecMeant <secmeant@gmail.com>2020-06-29 19:31:21 +0200
committerSecMeant <secmeant@gmail.com>2020-06-29 19:31:21 +0200
commit2717bb70eadf98411dee246de389668ea7033499 (patch)
tree3cfc78c8735140f7aa2b1afe8567e47312a0085c
parent95d70525cec057b4ba556bdb552983e079ea70fa (diff)
Adding constexpr_to_string namespace
Namespace is used to prevent pollution of global namespace by digits and digits_count symbols.
-rw-r--r--to_string.hpp6
1 files changed, 5 insertions, 1 deletions
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 <type_traits>
+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<N>()` to `to_string<N>`.
*/
template<auto N, int base = 10, typename char_type = char>
-constexpr to_string_t<N, base, char_type> to_string;
+constexpr constexpr_to_string::to_string_t<N, base, char_type> to_string;
#endif // TCSULLIVAN_TO_STRING_HPP_