]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/parameter/test/literate/deduced-template-parameters0.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / parameter / test / literate / deduced-template-parameters0.cpp
index 2e08b81d60bdb25c399f60716209553cf662f3ed..2fb1cd82beced7c004458370404c46a25bcbe7a0 100644 (file)
 
 #include <boost/parameter.hpp>
-#include <boost/mpl/is_sequence.hpp>
-#include <boost/noncopyable.hpp>
-#include <memory>
-#include <boost/config.hpp>
-
-using namespace boost::parameter;
-using boost::mpl::_;
 
 namespace boost { namespace python {
 
-BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
-BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
-BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
-BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
-
+    BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
+    BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
+    BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
+    BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
 }}
-namespace boost { namespace python {
 
-namespace detail { struct bases_base {}; }
+namespace boost { namespace python {
+    namespace detail {
 
-template <class A0 = void, class A1 = void, class A2 = void  >
-struct bases : detail::bases_base
-{};
+        struct bases_base
+        {
+        };
+    }
 
+    template <typename A0 = void, typename A1 = void, typename A2 = void>
+    struct bases : detail::bases_base
+    {
+    };
 }}
 
-
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_base_of.hpp>
 #include <boost/type_traits/is_class.hpp>
-namespace boost { namespace python {
-typedef parameter::parameters<
-    required<tag::class_type, is_class<_> >
+#include <boost/config.hpp>
 
-  , parameter::optional<
-        deduced<tag::base_list>
-      , is_base_and_derived<detail::bases_base,_>
-    >
+#if !defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) || \
+    !(1 == BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION)
+#include <boost/type_traits/is_scalar.hpp>
+#endif
+
+namespace boost { namespace python {
 
-  , parameter::optional<
-        deduced<tag::held_type>
-      , mpl::not_<
-            mpl::or_<
-                is_base_and_derived<detail::bases_base,_>
-              , is_same<noncopyable,_>
+    typedef boost::parameter::parameters<
+        boost::parameter::required<
+            tag::class_type
+#if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) && \
+    (1 == BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION)
+          , boost::mpl::if_<
+                boost::is_class<boost::mpl::_>
+              , boost::mpl::true_
+              , boost::mpl::false_
+            >
+#else
+          , boost::mpl::if_<
+                boost::is_scalar<boost::mpl::_>
+              , boost::mpl::false_
+              , boost::mpl::true_
+            >
+#endif
+        >
+      , boost::parameter::optional<
+            boost::parameter::deduced<tag::base_list>
+          , boost::mpl::if_<
+                boost::is_base_of<detail::bases_base,boost::mpl::_>
+              , boost::mpl::true_
+              , boost::mpl::false_
             >
         >
-    >
+      , boost::parameter::optional<
+            boost::parameter::deduced<tag::held_type>
+          , boost::mpl::eval_if<
+                boost::is_base_of<detail::bases_base,boost::mpl::_>
+              , boost::mpl::false_
+              , boost::mpl::if_<
+                    boost::is_same<boost::noncopyable,boost::mpl::_>
+                  , boost::mpl::false_
+                  , boost::mpl::true_
+                >
+            >
+        >
+      , boost::parameter::optional<
+            boost::parameter::deduced<tag::copyable>
+          , boost::mpl::if_<
+                boost::is_same<boost::noncopyable,boost::mpl::_>
+              , boost::mpl::true_
+              , boost::mpl::false_
+            >
+        >
+    > class_signature;
 
-  , parameter::optional<deduced<tag::copyable>, is_same<noncopyable,_> >
+    template <
+        typename A0
+      , typename A1 = boost::parameter::void_
+      , typename A2 = boost::parameter::void_
+      , typename A3 = boost::parameter::void_
+    >
+    struct class_
+    {
+        // Create ArgumentPack
+        typedef typename boost::python::class_signature::BOOST_NESTED_TEMPLATE
+        bind<A0,A1,A2,A3>::type args;
+
+        // Extract first logical parameter.
+        typedef typename boost::parameter::value_type<
+            args,boost::python::tag::class_type
+        >::type class_type;
+
+        typedef typename boost::parameter::value_type<
+            args,boost::python::tag::base_list,boost::python::bases<>
+        >::type base_list;
+
+        typedef typename boost::parameter::value_type<
+            args,boost::python::tag::held_type,class_type
+        >::type held_type;
+
+        typedef typename boost::parameter::value_type<
+            args,boost::python::tag::copyable,void
+        >::type copyable;
+    };
+}}
 
-> class_signature;
-template <
-    class A0
-  , class A1 = parameter::void_
-  , class A2 = parameter::void_
-  , class A3 = parameter::void_
->
-struct class_
+struct B
 {
-    // Create ArgumentPack
-    typedef typename
-      class_signature::bind<A0,A1,A2,A3>::type
-    args;
-
-    // Extract first logical parameter.
-    typedef typename parameter::value_type<
-      args, tag::class_type>::type class_type;
-
-    typedef typename parameter::value_type<
-      args, tag::base_list, bases<> >::type base_list;
-
-    typedef typename parameter::value_type<
-      args, tag::held_type, class_type>::type held_type;
-
-    typedef typename parameter::value_type<
-      args, tag::copyable, void>::type copyable;
 };
 
-}}
-
-
+struct D
+{
+};
 
-struct B {};
-struct D {};
+typedef boost::python::class_<B,boost::noncopyable> c1;
 
-using boost::python::bases;
-typedef boost::python::class_<B, boost::noncopyable> c1;
+#include <memory>
 
 #if defined(BOOST_NO_CXX11_SMART_PTR)
-
-typedef boost::python::class_<D, std::auto_ptr<D>, bases<B> > c2;
-
+typedef boost::python::class_<D,std::auto_ptr<D>,boost::python::bases<B> > c2;
 #else
-
-typedef boost::python::class_<D, std::unique_ptr<D>, bases<B> > c2;
-
+typedef boost::python::class_<
+    D,std::unique_ptr<D>,boost::python::bases<B>
+> c2;
 #endif
 
-BOOST_MPL_ASSERT((boost::is_same<c1::class_type, B>));
-BOOST_MPL_ASSERT((boost::is_same<c1::base_list, bases<> >));
-BOOST_MPL_ASSERT((boost::is_same<c1::held_type, B>));
-BOOST_MPL_ASSERT((
-     boost::is_same<c1::copyable, boost::noncopyable>
-));
-
-BOOST_MPL_ASSERT((boost::is_same<c2::class_type, D>));
-BOOST_MPL_ASSERT((boost::is_same<c2::base_list, bases<B> >));
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/aux_/test.hpp>
 
+MPL_TEST_CASE()
+{
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c1::class_type,B>
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c1::base_list,boost::python::bases<> >
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c1::held_type,B>
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c1::copyable,boost::noncopyable>
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c2::class_type,D>
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c2::base_list,boost::python::bases<B> >
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
 #if defined(BOOST_NO_CXX11_SMART_PTR)
-
-BOOST_MPL_ASSERT((
-    boost::is_same<c2::held_type, std::auto_ptr<D> >
-));
-
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c2::held_type,std::auto_ptr<D> >
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
 #else
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c2::held_type,std::unique_ptr<D> >
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
+#endif  // BOOST_NO_CXX11_SMART_PTR
+    BOOST_MPL_ASSERT((
+        boost::mpl::if_<
+            boost::is_same<c2::copyable,void>
+          , boost::mpl::true_
+          , boost::mpl::false_
+        >::type
+    ));
+}
 
-BOOST_MPL_ASSERT((
-    boost::is_same<c2::held_type, std::unique_ptr<D> >
-));
-
-#endif
-
-BOOST_MPL_ASSERT((boost::is_same<c2::copyable, void>));