From: Casey Bodley Date: Mon, 2 Mar 2020 20:23:48 +0000 (-0500) Subject: denc: remove conditional underlying_type_t from ceph_le* traits X-Git-Tag: v15.1.1~140^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bd1b21ed7ba0dafc22abfe982cb86429cfb0336f;p=ceph.git denc: remove conditional underlying_type_t from ceph_le* traits an enum's underlying type must be integral, so it's not possible for ceph_le to match for enums. for example, this: enum class enum_class_16 : ceph_le16 {}; fails to compile with: underlying type ‘ceph_le16’ {aka ‘ceph_le’} of ‘enum_class_16’ must be an integral type Signed-off-by: Casey Bodley --- diff --git a/src/include/denc.h b/src/include/denc.h index adb93ad16a1..6eb027cc0f5 100644 --- a/src/include/denc.h +++ b/src/include/denc.h @@ -268,17 +268,7 @@ template int DencDumper::i = 0; namespace _denc { template inline constexpr bool is_any_of = (... || std::is_same_v); - -template struct underlying_type { - using type = T; -}; -template -struct underlying_type>> { - using type = std::underlying_type_t; -}; -template -using underlying_type_t = typename underlying_type::type; -} +} // namespace _denc template struct is_const_iterator @@ -307,11 +297,12 @@ get_pos_add(It& i) { return *reinterpret_cast(i.get_pos_add(sizeof(T))); } +// network-order integer encoding template struct denc_traits< T, std::enable_if_t< - _denc::is_any_of<_denc::underlying_type_t, + _denc::is_any_of