Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:10:10

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_DETAIL_ACCESS_HPP_INCLUDED
0012 #define BOOST_TYPE_ERASURE_DETAIL_ACCESS_HPP_INCLUDED
0013 
0014 #include <boost/type_erasure/detail/storage.hpp>
0015 #include <boost/type_erasure/detail/any_base.hpp>
0016 
0017 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
0018     !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
0019     !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \
0020     !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && \
0021     !BOOST_WORKAROUND(BOOST_MSVC, == 1800) && \
0022     !BOOST_WORKAROUND(BOOST_GCC, < 40800) && /* Inherited constructors */ \
0023     !(defined(__clang_major__) && __clang_major__ == 3 && __clang__minor__ <= 2) /* Inherited constructors */
0024 #define BOOST_TYPE_ERASURE_SFINAE_FRIENDLY_CONSTRUCTORS
0025 #include <boost/type_traits/is_reference.hpp>
0026 #include <boost/utility/enable_if.hpp>
0027 #endif
0028 
0029 namespace boost {
0030 namespace type_erasure {
0031 
0032 template<class Concept, class T>
0033 class any;
0034 
0035 template<class Concept, class T>
0036 class param;
0037 
0038 template<class Concept>
0039 class binding;
0040 
0041 namespace detail {
0042 
0043 struct access
0044 {
0045     template<class Derived>
0046     static const typename Derived::table_type&
0047     table(const ::boost::type_erasure::any_base<Derived>& arg)
0048     {
0049         return static_cast<const Derived&>(arg).table;
0050     }
0051     template<class Concept, class T>
0052     static const ::boost::type_erasure::binding<Concept>&
0053     table(const ::boost::type_erasure::param<Concept, T>& arg)
0054     {
0055         return table(arg._impl);
0056     }
0057     template<class Concept, class T>
0058     static const ::boost::type_erasure::binding<Concept>&
0059     table(const ::boost::type_erasure::param<Concept, T&>& arg)
0060     {
0061         return arg._impl.table;
0062     }
0063 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0064     template<class Concept, class T>
0065     static const ::boost::type_erasure::binding<Concept>&
0066     table(const ::boost::type_erasure::param<Concept, T&&>& arg)
0067     {
0068         return arg._impl.table;
0069     }
0070 #endif
0071 #ifdef BOOST_TYPE_ERASURE_SFINAE_FRIENDLY_CONSTRUCTORS
0072     template<class Concept, class T, class = typename ::boost::enable_if_c<!::boost::is_reference<T>::value>::type>
0073     static const typename any<Concept, T>::table_type&
0074     table(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >& arg)
0075     {
0076         return static_cast<const ::boost::type_erasure::any<Concept, T>&>(arg)._boost_type_erasure_table;
0077     }
0078     template<class Concept, class T>
0079     static ::boost::type_erasure::detail::storage&
0080     data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >& arg)
0081     {
0082         return static_cast< ::boost::type_erasure::any<Concept, T>&>(arg)._boost_type_erasure_data;
0083     }
0084     template<class Concept, class T>
0085     static const ::boost::type_erasure::detail::storage&
0086     data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >& arg)
0087     {
0088         return static_cast<const ::boost::type_erasure::any<Concept, T>&>(arg)._boost_type_erasure_data;
0089     }
0090     template<class Concept, class T>
0091     static ::boost::type_erasure::detail::storage&&
0092     data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >&& arg)
0093     {
0094         return std::move(static_cast< ::boost::type_erasure::any<Concept, T>&&>(arg)._boost_type_erasure_data);
0095     }
0096 #endif
0097     template<class Derived>
0098     static ::boost::type_erasure::detail::storage&
0099     data(::boost::type_erasure::any_base<Derived>& arg)
0100     {
0101         return static_cast<Derived&>(arg).data;
0102     }
0103     template<class Concept, class T>
0104     static const ::boost::type_erasure::detail::storage&
0105     data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, const T&> >& arg)
0106     {
0107         return static_cast< ::boost::type_erasure::any<Concept, const T&>&>(arg).data;
0108     }
0109     template<class Derived>
0110     static const ::boost::type_erasure::detail::storage&
0111     data(const ::boost::type_erasure::any_base<Derived>& arg)
0112     {
0113         return static_cast<const Derived&>(arg).data;
0114     }
0115     template<class Concept, class T>
0116     static ::boost::type_erasure::detail::storage&
0117     data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&> >& arg)
0118     {
0119         return const_cast< ::boost::type_erasure::detail::storage&>(static_cast< ::boost::type_erasure::any<Concept, T&>&>(arg).data);
0120     }
0121     template<class Concept, class T>
0122     static ::boost::type_erasure::detail::storage&
0123     data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&> >& arg)
0124     {
0125         return const_cast< ::boost::type_erasure::detail::storage&>(static_cast< const ::boost::type_erasure::any<Concept, T&>&>(arg).data);
0126     }
0127     template<class Concept, class T>
0128     static const ::boost::type_erasure::detail::storage&
0129     data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, const T&> >& arg)
0130     {
0131         return static_cast<const ::boost::type_erasure::any<Concept, const T&>&>(arg).data;
0132     }
0133     template<class Concept, class T>
0134     static ::boost::type_erasure::detail::storage&
0135     data(::boost::type_erasure::param<Concept, T>& arg)
0136     {
0137         return data(arg._impl);
0138     }
0139     template<class Concept, class T>
0140     static ::boost::type_erasure::detail::storage&
0141     data(::boost::type_erasure::param<Concept, T&>& arg)
0142     {
0143         return arg._impl.data;
0144     }
0145     template<class Concept, class T>
0146     static const ::boost::type_erasure::detail::storage&
0147     data(::boost::type_erasure::param<Concept, const T&>& arg)
0148     {
0149         return arg._impl.data;
0150     }
0151     template<class Concept, class T>
0152     static const ::boost::type_erasure::detail::storage&
0153     data(const ::boost::type_erasure::param<Concept, T>& arg)
0154     {
0155         return data(arg._impl);
0156     }
0157     template<class Concept, class T>
0158     static const ::boost::type_erasure::detail::storage&
0159     data(const ::boost::type_erasure::param<Concept, T&>& arg)
0160     {
0161         return arg._impl.data;
0162     }
0163 
0164 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
0165 
0166     template<class Derived>
0167     static ::boost::type_erasure::detail::storage&&
0168     data(::boost::type_erasure::any_base<Derived>&& arg)
0169     {
0170         return std::move(static_cast<Derived&>(arg).data);
0171     }
0172     template<class Concept, class T>
0173     static ::boost::type_erasure::detail::storage&&
0174     data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&&> >& arg)
0175     {
0176         return std::move(static_cast< ::boost::type_erasure::any<Concept, T&&>&>(arg).data);
0177     }
0178     template<class Concept, class T>
0179     static ::boost::type_erasure::detail::storage&&
0180     data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&&> >&& arg)
0181     {
0182         return std::move(static_cast< ::boost::type_erasure::any<Concept, T&&>&>(arg).data);
0183     }
0184     template<class Concept, class T>
0185     static ::boost::type_erasure::detail::storage&&
0186     data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&&> >& arg)
0187     {
0188         return std::move(const_cast< ::boost::type_erasure::detail::storage&>(static_cast< const ::boost::type_erasure::any<Concept, T&&>&>(arg).data));
0189     }
0190     template<class Concept, class T>
0191     static ::boost::type_erasure::detail::storage&
0192     data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&> >&& arg)
0193     {
0194         return std::move(static_cast< ::boost::type_erasure::any<Concept, T&>&>(arg).data);
0195     }
0196 
0197     template<class Concept, class T>
0198     static ::boost::type_erasure::detail::storage&&
0199     data(::boost::type_erasure::param<Concept, T>&& arg)
0200     {
0201         return std::move(data(arg._impl));
0202     }
0203     template<class Concept, class T>
0204     static ::boost::type_erasure::detail::storage&&
0205     data(::boost::type_erasure::param<Concept, T&&>&& arg)
0206     {
0207         return std::move(arg._impl.data);
0208     }
0209     template<class Concept, class T>
0210     static ::boost::type_erasure::detail::storage&
0211     data(::boost::type_erasure::param<Concept, T&>&& arg)
0212     {
0213         return arg._impl.data;
0214     }
0215     template<class Concept, class T>
0216     static const ::boost::type_erasure::detail::storage&
0217     data(::boost::type_erasure::param<Concept, const T&>&& arg)
0218     {
0219         return arg._impl.data;
0220     }
0221     template<class Concept, class T>
0222     static ::boost::type_erasure::detail::storage&&
0223     data(::boost::type_erasure::param<Concept, T&&>& arg)
0224     {
0225         return std::move(arg._impl.data);
0226     }
0227     template<class Concept, class T>
0228     static ::boost::type_erasure::detail::storage&&
0229     data(const ::boost::type_erasure::param<Concept, T&&>& arg)
0230     {
0231         return std::move(const_cast< ::boost::type_erasure::detail::storage&>(arg._impl.data));
0232     }
0233 
0234 #endif
0235 
0236 };
0237 
0238 }
0239 }
0240 }
0241 
0242 #endif