Removing magic constant from template param check #3

Merged
SecMeant merged 3 commits from digits_array into master 2020-06-29 15:17:39 -04:00
Showing only changes of commit 2717bb70ea - Show all commits

View File

@ -9,6 +9,8 @@
#include <type_traits>
namespace constexpr_to_string {
constexpr char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
Neargye commented 2020-06-27 12:20:45 -04:00 (Migrated from github.com)
Review

inline constexpr

`inline constexpr `
m-peko commented 2020-06-29 08:43:29 -04:00 (Migrated from github.com)
Review

@Neargye why inline constexpr when constexpr itself is implicitly inline?

@Neargye why `inline constexpr` when `constexpr` itself is implicitly inline?
Neargye commented 2020-06-29 08:47:46 -04:00 (Migrated from github.com)
Review

​constexpr specifier implies  inline for static data members as well as functions, but not for global variable.
https://en.cppreference.com/w/cpp/language/inline

​constexpr specifier implies  inline for static data members as well as functions, but not for global variable. https://en.cppreference.com/w/cpp/language/inline
constexpr auto digit_count = sizeof(digits) / sizeof(digits[0]);
Neargye commented 2020-06-27 12:20:55 -04:00 (Migrated from github.com)
Review

also inline constexpr

also `inline constexpr`
@ -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_