]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
include/denc: rewrite ExtType with is_any_of<>
authorKefu Chai <tchaikov@gmail.com>
Sun, 21 Aug 2022 00:41:01 +0000 (08:41 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sun, 21 Aug 2022 02:09:14 +0000 (10:09 +0800)
just for better readability

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/include/denc.h

index cdd4b0c320217cb615c43df77bda4815028c93ce..92224252a52a1ddd8f64f132dd78cc831316fd69 100644 (file)
@@ -342,25 +342,28 @@ struct denc_traits<T> {
 // up a contiguous_appender etc is likely to be slower.
 namespace _denc {
 
-template<typename T, typename=void> struct ExtType {
+template<typename T> struct ExtType {
   using type = void;
 };
 
 template<typename T>
-struct ExtType<T, std::enable_if_t<std::is_same_v<T, int16_t> ||
-                                  std::is_same_v<T, uint16_t>>> {
+requires _denc::is_any_of<T,
+                         int16_t, uint16_t>
+struct ExtType<T> {
   using type = ceph_le16;
 };
 
 template<typename T>
-struct ExtType<T, std::enable_if_t<std::is_same_v<T, int32_t> ||
-                                  std::is_same_v<T, uint32_t>>> {
+requires _denc::is_any_of<T,
+                         int32_t, uint32_t>
+struct ExtType<T> {
   using type = ceph_le32;
 };
 
 template<typename T>
-struct ExtType<T, std::enable_if_t<std::is_same_v<T, int64_t> ||
-                                  std::is_same_v<T, uint64_t>>> {
+requires _denc::is_any_of<T,
+                         int64_t, uint64_t>
+struct ExtType<T> {
   using type = ceph_le64;
 };