]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/parameter/value_type.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / parameter / value_type.hpp
index a323dcf37c2ba7f1cc62b3e770030abbf55c87af..1b0ad354c9d711b69b0ce152d59b40708ec4c9c0 100644 (file)
-// Copyright Daniel Wallin 2006. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// Copyright Daniel Wallin 2006.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
 
 #ifndef BOOST_PARAMETER_VALUE_TYPE_060921_HPP
-# define BOOST_PARAMETER_VALUE_TYPE_060921_HPP
+#define BOOST_PARAMETER_VALUE_TYPE_060921_HPP
 
-# include <boost/mpl/apply.hpp>
-# include <boost/mpl/assert.hpp>
-# include <boost/mpl/and.hpp>
-# include <boost/parameter/aux_/result_of0.hpp>
-# include <boost/parameter/aux_/void.hpp>
-# include <boost/type_traits/is_same.hpp>
+#include <boost/parameter/aux_/void.hpp>
+#include <boost/parameter/config.hpp>
+
+#if defined(BOOST_PARAMETER_CAN_USE_MP11)
+#include <boost/mp11/integral.hpp>
+#include <boost/mp11/list.hpp>
+#include <boost/mp11/utility.hpp>
+#include <type_traits>
+#else
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/apply_wrap.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#endif
 
 namespace boost { namespace parameter { 
 
-// A metafunction that, given an argument pack, returns the type of
-// the parameter identified by the given keyword.  If no such
-// parameter has been specified, returns Default
-
-# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-template <class Parameters, class Keyword, class Default>
-struct value_type0
-{
-    typedef typename mpl::apply_wrap3<
-        typename Parameters::binding,Keyword,Default,mpl::false_
-    >::type type;
-
-    BOOST_MPL_ASSERT_NOT((
-        mpl::and_<
-            is_same<Default, void_>
-          , is_same<type, void_>
-        >
-    ));
-};
-# endif
-
-template <class Parameters, class Keyword, class Default = void_>
-struct value_type
-{
-# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
-    typedef typename mpl::eval_if<
-        mpl::is_placeholder<Parameters>
-      , mpl::identity<int>
-      , value_type0<Parameters,Keyword,Default>
-    >::type type;
-# else
-    typedef typename mpl::apply_wrap3<
-        typename Parameters::binding,Keyword,Default,mpl::false_
-    >::type type;
-
-    BOOST_MPL_ASSERT_NOT((
-        mpl::and_<
-            is_same<Default, void_>
-          , is_same<type, void_>
+    // A metafunction that, given an argument pack, returns the value type
+    // of the parameter identified by the given keyword.  If no such parameter
+    // has been specified, returns Default
+
+    template <typename Parameters, typename Keyword, typename Default>
+    struct value_type0
+    {
+#if defined(BOOST_PARAMETER_CAN_USE_MP11)
+        using type = ::boost::mp11::mp_apply_q<
+            typename Parameters::binding
+          , ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_false>
+        >;
+
+        static_assert(
+            ::boost::mp11::mp_if<
+                ::std::is_same<Default,::boost::parameter::void_>
+              , ::boost::mp11::mp_if<
+                    ::std::is_same<type,::boost::parameter::void_>
+                  , ::boost::mp11::mp_false
+                  , ::boost::mp11::mp_true
+                >
+              , ::boost::mp11::mp_true
+            >::value
+          , "required parameters must not result in void_ type"
+        );
+#else   // !defined(BOOST_PARAMETER_CAN_USE_MP11)
+        typedef typename ::boost::mpl::apply_wrap3<
+            typename Parameters::binding
+          , Keyword
+          , Default
+          , ::boost::mpl::false_
+        >::type type;
+
+        BOOST_MPL_ASSERT((
+            typename ::boost::mpl::eval_if<
+                ::boost::is_same<Default,::boost::parameter::void_>
+              , ::boost::mpl::if_<
+                    ::boost::is_same<type,::boost::parameter::void_>
+                  , ::boost::mpl::false_
+                  , ::boost::mpl::true_
+                >
+              , ::boost::mpl::true_
+            >::type
+        ));
+#endif  // BOOST_PARAMETER_CAN_USE_MP11
+    };
+
+#if defined(BOOST_PARAMETER_CAN_USE_MP11)
+    template <typename Placeholder, typename Keyword, typename Default>
+    struct value_type1
+    {
+        using type = ::boost::mp11::mp_apply_q<
+            Placeholder
+          , ::boost::mp11::mp_list<Keyword,Default,::boost::mp11::mp_false>
+        >;
+
+        static_assert(
+            ::boost::mp11::mp_if<
+                ::std::is_same<Default,::boost::parameter::void_>
+              , ::boost::mp11::mp_if<
+                    ::std::is_same<type,::boost::parameter::void_>
+                  , ::boost::mp11::mp_false
+                  , ::boost::mp11::mp_true
+                >
+              , ::boost::mp11::mp_true
+            >::value
+          , "required parameters must not result in void_ type"
+        );
+    };
+#endif  // BOOST_PARAMETER_CAN_USE_MP11
+}} // namespace boost::parameter
+
+#include <boost/parameter/aux_/is_placeholder.hpp>
+
+namespace boost { namespace parameter { 
+
+    template <
+        typename Parameters
+      , typename Keyword
+      , typename Default = ::boost::parameter::void_
+    >
+    struct value_type
+#if !defined(BOOST_PARAMETER_CAN_USE_MP11)
+      : ::boost::mpl::eval_if<
+            ::boost::parameter::aux::is_mpl_placeholder<Parameters>
+          , ::boost::mpl::identity<int>
+          , ::boost::parameter::value_type0<Parameters,Keyword,Default>
         >
-    ));
-# endif
-
-    BOOST_MPL_AUX_LAMBDA_SUPPORT(3,value_type,(Parameters,Keyword,Default))
-};
-
-// A metafunction that, given an argument pack, returns the type of
-// the parameter identified by the given keyword.  If no such
-// parameter has been specified, returns the type returned by invoking
-// DefaultFn
-template <class Parameters, class Keyword, class DefaultFn>
-struct lazy_value_type
-{
-  typedef typename mpl::apply_wrap3<
-      typename Parameters::binding
-    , Keyword
-    , typename aux::result_of0<DefaultFn>::type
-    , mpl::false_
-  >::type type;
-};
+#endif
+    {
+#if defined(BOOST_PARAMETER_CAN_USE_MP11)
+        using type = typename ::boost::mp11::mp_if<
+            ::boost::parameter::aux::is_mpl_placeholder<Parameters>
+          , ::boost::mp11::mp_identity<int>
+          , ::boost::mp11::mp_if<
+                ::boost::parameter::aux::is_mp11_placeholder<Parameters>
+              , ::boost::parameter::value_type1<Parameters,Keyword,Default>
+              , ::boost::parameter::value_type0<Parameters,Keyword,Default>
+            >
+        >::type;
+#endif
+    };
+}} // namespace boost::parameter
+
+#include <boost/parameter/aux_/result_of0.hpp>
 
+namespace boost { namespace parameter { 
 
+    // A metafunction that, given an argument pack, returns the value type
+    // of the parameter identified by the given keyword.  If no such parameter
+    // has been specified, returns the type returned by invoking DefaultFn
+    template <typename Parameters, typename Keyword, typename DefaultFn>
+    struct lazy_value_type
+    {
+#if defined(BOOST_PARAMETER_CAN_USE_MP11)
+        using type = ::boost::mp11::mp_apply_q<
+            typename Parameters::binding
+          , ::boost::mp11::mp_list<
+                Keyword
+              , typename ::boost::parameter::aux::result_of0<DefaultFn>::type
+              , ::boost::mp11::mp_false
+            >
+        >;
+#else
+        typedef typename ::boost::mpl::apply_wrap3<
+            typename Parameters::binding
+          , Keyword
+          , typename ::boost::parameter::aux::result_of0<DefaultFn>::type
+          , ::boost::mpl::false_
+        >::type type;
+#endif  // BOOST_PARAMETER_CAN_USE_MP11
+    };
 }} // namespace boost::parameter
 
-#endif // BOOST_PARAMETER_VALUE_TYPE_060921_HPP
+#endif  // include guard