From: Changcheng Liu Date: Mon, 22 Jun 2020 01:39:59 +0000 (+0800) Subject: common: short variable template with suffix_v/_t X-Git-Tag: wip-pdonnell-testing-20200918.022351~904^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f93d80aa80e9b70871f2e4114c57e3250fd797f6;p=ceph-ci.git common: short variable template with suffix_v/_t Signed-off-by: Changcheng Liu --- diff --git a/src/common/options.h b/src/common/options.h index f0ed014e303..75812c23450 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 a7c0cc220b6..6d722269320 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) {