summaryrefslogtreecommitdiff
path: root/boost/type_erasure/param.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/type_erasure/param.hpp')
-rw-r--r--boost/type_erasure/param.hpp51
1 files changed, 36 insertions, 15 deletions
diff --git a/boost/type_erasure/param.hpp b/boost/type_erasure/param.hpp
index e3cce05898..7aca5e3c6b 100644
--- a/boost/type_erasure/param.hpp
+++ b/boost/type_erasure/param.hpp
@@ -27,12 +27,16 @@
namespace boost {
namespace type_erasure {
+#ifndef BOOST_TYPE_ERASURE_DOXYGEN
+
template<class Concept, class T>
class any;
template<class Concept>
class binding;
+#endif
+
namespace detail {
struct access;
@@ -75,16 +79,6 @@ struct placeholder_conversion<T&&, T&&> : boost::mpl::true_ {};
}
-#ifdef __clang__
-#if !__has_feature(cxx_reference_qualified_functions)
-/** INTERNAL ONLY */
-#define BOOST_NO_FUNCTION_REFERENCE_QUALIFIERS
-#endif
-#else
-/** INTERNAL ONLY */
-#define BOOST_NO_FUNCTION_REFERENCE_QUALIFIERS
-#endif
-
/**
* \brief A wrapper to help with overload resolution for functions
* operating on an @ref any.
@@ -96,8 +90,8 @@ struct placeholder_conversion<T&&, T&&> : boost::mpl::true_ {};
* with an @ref any that has the same @c Concept
* and base placeholder when there exists a corresponding
* standard conversion for the placeholder.
- * A conversion sequence from @ref any<C, P> to @ref param<C, P1> is
- * a better conversion sequence than @ref any<C, P> to @ref param<C, P2>
+ * A conversion sequence from @ref any "any<C, P>" to @ref param "param<C, P1>" is
+ * a better conversion sequence than @ref any "any<C, P>" to @ref param "param<C, P2>"
* iff the corresponding placeholder standard conversion
* sequence from P to P1 is a better conversion sequence than
* P to P2.
@@ -172,13 +166,19 @@ public:
{}
#endif
+ /** INTERNAL ONLY */
+ param(const ::boost::type_erasure::detail::storage& data,
+ const ::boost::type_erasure::binding<Concept>& table)
+ : _impl(data, table)
+ {}
+
/** Returns the stored @ref any. */
any<Concept, T> get() const { return _impl; }
private:
any<Concept, T> _impl;
};
-#ifndef BOOST_NO_FUNCTION_REFERENCE_QUALIFIERS
+#if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) && !defined(BOOST_TYPE_ERASURE_DOXYGEN)
template<class Concept, class T>
class param<Concept, const T&> {
@@ -199,7 +199,21 @@ public:
param(U& u, typename boost::enable_if< ::boost::is_same<U, const any<Concept, T> > >::type* = 0) : _impl(u) {}
any<Concept, const T&> get() const { return _impl; }
protected:
- any<Concept, const T&> _impl;
+ struct _impl_t {
+ _impl_t(const ::boost::type_erasure::detail::storage& data_,
+ const ::boost::type_erasure::binding<Concept>& table_)
+ : table(table_), data(data_)
+ {}
+ _impl_t(const any<Concept, T>& u)
+ : table(::boost::type_erasure::detail::access::table(u)),
+ data(::boost::type_erasure::detail::access::data(u))
+ {}
+ // It's safe to capture the table by reference, because
+ // the user's argument should out-live us. storage is
+ // just a void*, so we don't need to add indirection.
+ const ::boost::type_erasure::binding<Concept>& table;
+ ::boost::type_erasure::detail::storage data;
+ } _impl;
};
template<class Concept, class T>
@@ -257,7 +271,7 @@ public:
/**
* \brief Metafunction that creates a @ref param.
*
- * If @c T is a (cv/reference qualifed) placeholder,
+ * If @c T is a (cv/reference qualified) placeholder,
* returns @ref param<@ref concept_of "concept_of<Any>::type", T>,
* otherwise, returns T. This metafunction is intended
* to be used for function arguments in specializations of
@@ -280,6 +294,13 @@ struct as_param {
#endif
};
+#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES
+
+template<class Any, class T>
+using as_param_t = typename ::boost::type_erasure::as_param<Any, T>::type;
+
+#endif
+
}
}