]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
denc: specialize for denc(const T&, size_t&, uint64_t)
authorKefu Chai <kchai@redhat.com>
Fri, 25 May 2018 04:34:33 +0000 (12:34 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 8 Jun 2018 12:58:15 +0000 (20:58 +0800)
otherwise GCC complains that 'unsigned long int' is not a class or
namespace when trying to materialize is_const_iterator_v<>. not sure why
SFINAE does not work here, though.

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

index cd8a43360678a78dc65e69a5adca4c282047a8ab..f80f1a0c4c46d7bb0766e0c53c9fcf696f224d7c 100644 (file)
@@ -243,14 +243,16 @@ using underlying_type_t = typename underlying_type<T>::type;
 }
 
 template<class It>
-struct is_const_iterator {
-  using pointer = typename It::pointer;
-  static constexpr bool value = std::is_const_v<std::remove_pointer_t<pointer>>;
-};
+struct is_const_iterator
+  : std::conditional_t<std::is_const_v<std::remove_pointer_t<typename It::pointer>>,
+                      std::true_type,
+                      std::false_type>
+{};
+template<>
+struct is_const_iterator<size_t> : std::false_type {};
 template<>
-struct is_const_iterator<buffer::list::contiguous_appender> {
+struct is_const_iterator<buffer::list::contiguous_appender> : std::false_type {
   // appender is used for *changing* the buffer
-  static constexpr bool value = false;
 };
 template<class It>
 inline constexpr bool is_const_iterator_v = is_const_iterator<It>::value;