]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/type_erasure/is_subconcept.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / type_erasure / is_subconcept.hpp
index aa8ee6585a0ed7a6afa76c4602c36027ef4d6b91..c327731094c85ec22ba1866da7235f990d34a055 100644 (file)
@@ -11,6 +11,7 @@
 #ifndef BOOST_TYPE_ERASURE_IS_SUBCONCEPT_HPP_INCLUDED
 #define BOOST_TYPE_ERASURE_IS_SUBCONCEPT_HPP_INCLUDED
 
+#include <boost/mpl/and.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/not.hpp>
 #include <boost/mpl/if.hpp>
@@ -19,6 +20,7 @@
 #include <boost/mpl/has_key.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/type_erasure/detail/normalize.hpp>
+#include <boost/type_erasure/detail/check_map.hpp>
 #include <boost/type_erasure/detail/rebind_placeholders.hpp>
 #include <boost/type_erasure/static_binding.hpp>
 
@@ -26,10 +28,33 @@ namespace boost {
 namespace type_erasure {
 namespace detail {
 
+#ifdef BOOST_TYPE_ERASURE_USE_MP11
+
+template<class S, class K>
+struct mp_set_has_key : ::boost::mp11::mp_set_contains<S, K> {};
+
+template<class Super, class Bindings>
+struct is_subconcept_f
+{
+    template<class T>
+    using apply = ::boost::mp11::mp_set_contains<Super, ::boost::type_erasure::detail::rebind_placeholders_t<T, Bindings> >;
+};
+
+template<class Super>
+struct is_subconcept_f<Super, void>
+{
+    template<class T>
+    using apply = ::boost::mp11::mp_set_contains<Super, T>;
+};
+
+#endif
+
 template<class Sub, class Super, class PlaceholderMap>
 struct is_subconcept_impl {
+#ifndef BOOST_TYPE_ERASURE_USE_MP11
     typedef typename ::boost::type_erasure::detail::normalize_concept<
         Super>::concept_set super_set;
+
     typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map<
         Super
     >::type placeholder_subs_super;
@@ -68,6 +93,30 @@ struct is_subconcept_impl {
         >::type,
         typename ::boost::mpl::end<normalized_sub>::type
     >::type type;
+#else
+    typedef ::boost::type_erasure::detail::normalize_concept_t<Super> super_set;
+
+    typedef ::boost::type_erasure::detail::get_placeholder_normalization_map_t<
+        Super
+    > placeholder_subs_super;
+    
+    typedef ::boost::type_erasure::detail::normalize_concept_t<Sub> normalized_sub;
+    typedef ::boost::type_erasure::detail::get_placeholder_normalization_map_t<
+        Sub
+    > placeholder_subs_sub;
+    typedef ::boost::mp11::mp_eval_if_c< ::boost::is_same<PlaceholderMap, void>::value,
+        void,
+        ::boost::type_erasure::detail::convert_deductions_t,
+        PlaceholderMap,
+        placeholder_subs_sub,
+        placeholder_subs_super
+    > bindings;
+
+    typedef typename ::boost::mp11::mp_all_of<
+        normalized_sub,
+        ::boost::type_erasure::detail::is_subconcept_f<super_set, bindings>::template apply
+    > type;
+#endif
 };
 
 }
@@ -92,13 +141,24 @@ struct is_subconcept_impl {
  *   are presumed to use the same set of placeholders.
  */
 template<class Sub, class Super, class PlaceholderMap = void>
-struct is_subconcept : ::boost::type_erasure::detail::is_subconcept_impl<Sub, Super, PlaceholderMap>::type {
-};
+struct is_subconcept :
+    ::boost::mpl::and_<
+        ::boost::type_erasure::detail::check_map<Sub, PlaceholderMap>,
+        ::boost::type_erasure::detail::is_subconcept_impl<Sub, Super, PlaceholderMap>
+    >::type
+{};
 
 #ifndef BOOST_TYPE_ERASURE_DOXYGEN
+template<class Sub, class Super>
+struct is_subconcept<Sub, Super, void> :
+    ::boost::type_erasure::detail::is_subconcept_impl<Sub, Super, void>::type
+{};
 template<class Sub, class Super, class PlaceholderMap>
 struct is_subconcept<Sub, Super, static_binding<PlaceholderMap> > :
-    ::boost::type_erasure::detail::is_subconcept_impl<Sub, Super, PlaceholderMap>::type
+    ::boost::mpl::and_<
+        ::boost::type_erasure::detail::check_map<Sub, PlaceholderMap>,
+        ::boost::type_erasure::detail::is_subconcept_impl<Sub, Super, PlaceholderMap>
+    >::type
 {};
 #endif