From: Adam C. Emerson Date: Tue, 9 Jan 2018 21:15:34 +0000 (-0500) Subject: denc: Simplify is_any_of X-Git-Tag: v13.0.2~525^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=617a0961ce41ddca9b9d9b83079e6b7f9b9908ac;p=ceph.git denc: Simplify is_any_of We can't simplify underlying type in the obvious way since template evaluation is strict. Signed-off-by: Adam C. Emerson --- diff --git a/src/include/denc.h b/src/include/denc.h index 3cc31234f5b0..b4b133a8460d 100644 --- a/src/include/denc.h +++ b/src/include/denc.h @@ -54,6 +54,9 @@ struct denc_traits { static constexpr bool need_contiguous = true; }; +template +inline constexpr bool denc_supported = denc_traits::supported; + // hack for debug only; FIXME //#include @@ -69,7 +72,7 @@ struct denc_traits { //#define ENCODE_DUMP_PATH /tmp/something #ifdef ENCODE_DUMP_PATH -# include +# include # include # include # include @@ -224,16 +227,8 @@ struct denc_traits { // --------------------------------------------------------------------- // raw types namespace _denc { -template -struct is_any_of : std::false_type {}; -template -struct is_any_of : std::conditional< - std::is_same::value, - std::true_type, - is_any_of>::type -{}; template -inline constexpr bool is_any_of_v = is_any_of::value; +inline constexpr bool is_any_of = (... || std::is_same_v); template struct underlying_type { using type = T; @@ -251,8 +246,8 @@ template struct denc_traits< T, std::enable_if_t< - _denc::is_any_of_v<_denc::underlying_type_t, - ceph_le64, ceph_le32, ceph_le16, uint8_t + _denc::is_any_of<_denc::underlying_type_t, + ceph_le64, ceph_le32, ceph_le16, uint8_t #ifndef _CHAR_IS_SIGNED , int8_t #endif