From f93d80aa80e9b70871f2e4114c57e3250fd797f6 Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Mon, 22 Jun 2020 09:39:59 +0800 Subject: [PATCH] common: short variable template with suffix_v/_t Signed-off-by: Changcheng Liu --- src/common/options.h | 12 ++++++------ src/common/strtol.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/options.h b/src/common/options.h index f0ed014e30394..75812c234503c 100644 --- a/src/common/options.h +++ b/src/common/options.h @@ -236,12 +236,12 @@ struct Option { // bool is an integer, but we don't think so. teach it the hard way. template - using is_not_integer = std::enable_if::value || - std::is_same::value, int>; + using is_not_integer_t = + std::enable_if_t || std::is_same_v, int>; template - using is_integer = std::enable_if::value && - !std::is_same::value, int>; - template::type = 0> + using is_integer_t = + std::enable_if_t && !std::is_same_v, int>; + template> Option& set_value(value_t& v, const T& new_value) { v = new_value; return *this; @@ -250,7 +250,7 @@ struct Option { // 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::type = 0> + template> Option& set_value(value_t& v, T new_value) { switch (type) { case TYPE_INT: diff --git a/src/common/strtol.h b/src/common/strtol.h index a7c0cc220b6f9..6d722269320b9 100644 --- a/src/common/strtol.h +++ b/src/common/strtol.h @@ -47,7 +47,7 @@ template static inline char* ritoa(T u, char *buf) { - static_assert(std::is_unsigned::value, "signed types are not supported"); + static_assert(std::is_unsigned_v, "signed types are not supported"); static_assert(base <= 16, "extend character map below to support higher bases"); unsigned digits = 0; while (u) { -- 2.39.5