// bool is an integer, but we don't think so. teach it the hard way.
template<typename T>
- using is_not_integer = std::enable_if<!std::is_integral<T>::value ||
- std::is_same<T, bool>::value, int>;
+ using is_not_integer_t =
+ std::enable_if_t<!std::is_integral_v<T> || std::is_same_v<T, bool>, int>;
template<typename T>
- using is_integer = std::enable_if<std::is_integral<T>::value &&
- !std::is_same<T, bool>::value, int>;
- template<typename T, typename is_not_integer<T>::type = 0>
+ using is_integer_t =
+ std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>, int>;
+ template<typename T, typename = is_not_integer_t<T>>
Option& set_value(value_t& v, const T& new_value) {
v = new_value;
return *this;
// For potentially ambiguous types, inspect Option::type and
// do some casting. This is necessary to make sure that setting
// a float option to "0" actually sets the double part of variant.
- template<typename T, typename is_integer<T>::type = 0>
+ template<typename T, typename = is_integer_t<T>>
Option& set_value(value_t& v, T new_value) {
switch (type) {
case TYPE_INT:
static inline
char* ritoa(T u, char *buf)
{
- static_assert(std::is_unsigned<T>::value, "signed types are not supported");
+ static_assert(std::is_unsigned_v<T>, "signed types are not supported");
static_assert(base <= 16, "extend character map below to support higher bases");
unsigned digits = 0;
while (u) {