Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/type_erasure/relaxed.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Boost.TypeErasure library
0002 //
0003 // Copyright 2011 Steven Watanabe
0004 //
0005 // Distributed under the Boost Software License Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // $Id$
0010 
0011 #ifndef BOOST_TYPE_ERASURE_RELAXED_HPP_INCLUDED
0012 #define BOOST_TYPE_ERASURE_RELAXED_HPP_INCLUDED
0013 
0014 #include <boost/mpl/vector.hpp>
0015 #include <boost/mpl/bool.hpp>
0016 #include <boost/mpl/is_sequence.hpp>
0017 #include <boost/mpl/find_if.hpp>
0018 #include <boost/mpl/not.hpp>
0019 #include <boost/mpl/end.hpp>
0020 #include <boost/type_traits/is_same.hpp>
0021 
0022 namespace boost {
0023 namespace type_erasure {
0024 
0025 template<class T>
0026 struct is_relaxed;
0027 
0028 namespace detail {
0029 
0030 template<class T>
0031 struct is_relaxed_impl :
0032     ::boost::mpl::not_<
0033         typename ::boost::is_same<
0034             typename ::boost::mpl::find_if<
0035                 T,
0036                 ::boost::type_erasure::is_relaxed< ::boost::mpl::_1>
0037             >::type,
0038             typename ::boost::mpl::end<T>::type
0039         >::type
0040     >::type
0041 {};
0042 
0043 }
0044 
0045 /**
0046  * This special concept enables various useful default behavior that
0047  * makes @ref any act like an ordinary object.  By default @ref any
0048  * forwards all operations to the underlying type, and provides only
0049  * the operations that are specified in its @c Concept.
0050  *
0051  * In detail, @ref relaxed enables the following:
0052  * - A raw value can be assigned to an @ref any.  This will replace
0053  *   the value stored by the @ref any.  (But note that if @ref assignable
0054  *   is present, it takes priority.)
0055  * - assignment of @ref any uses the constructor if it can't
0056  *   use @ref assignable (either because @ref assignable is missing,
0057  *   or because the stored types do not match).
0058  * - default construction of @ref any is allowed and creates a null any.
0059  * - @ref equality_comparable "equality_comparable": If the types do not
0060  *   match, it will return false.
0061  * - @ref less_than_comparable "less_than_comparable": If the types do not
0062  *   match, the ordering will be according to
0063  *   @c std::type_info::before.
0064  * - if the arguments to any other function do not match, it will throw
0065  *   a @ref bad_function_call exception instead of having undefined
0066  *   behavior.
0067  */
0068 struct relaxed : ::boost::mpl::vector0<> {};
0069 
0070 /**
0071  * A metafunction indicating whether @c Concept
0072  * includes @ref relaxed.
0073  */
0074 template<class Concept>
0075 struct is_relaxed :
0076     ::boost::mpl::eval_if< ::boost::mpl::is_sequence<Concept>,
0077         ::boost::type_erasure::detail::is_relaxed_impl<Concept>,
0078         ::boost::mpl::false_
0079     >::type
0080 {};
0081 
0082 /** INTERNAL ONLY */
0083 template<>
0084 struct is_relaxed< ::boost::type_erasure::relaxed> :
0085     ::boost::mpl::true_
0086 {};
0087 
0088 }
0089 }
0090 
0091 #endif