File indexing completed on 2025-01-30 09:58:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_INDIRECT_CONTAINER_NULLABLE_HPP
0014 #define BOOST_INDIRECT_CONTAINER_NULLABLE_HPP
0015
0016 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 # pragma once
0018 #endif
0019
0020 #include <boost/type_traits/detail/yes_no_type.hpp>
0021 #include <boost/type_traits/is_const.hpp>
0022 #include <boost/mpl/eval_if.hpp>
0023 #include <boost/mpl/identity.hpp>
0024 #include <boost/config.hpp>
0025
0026 namespace boost
0027 {
0028
0029 template< class T >
0030 struct nullable
0031 {
0032 typedef T type;
0033 };
0034
0035 namespace ptr_container_detail
0036 {
0037 template< class T >
0038 type_traits::yes_type is_nullable( const nullable<T>* );
0039
0040 type_traits::no_type is_nullable( ... );
0041 }
0042
0043 template< class T >
0044 struct is_nullable
0045 {
0046 private:
0047 BOOST_STATIC_CONSTANT( T*, var );
0048 public:
0049
0050 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
0051 #pragma warning(push)
0052 #pragma warning(disable:6334)
0053 #endif
0054
0055 BOOST_STATIC_CONSTANT(bool, value = sizeof( ptr_container_detail::is_nullable( var ) )
0056 == sizeof( type_traits::yes_type ) );
0057 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
0058 #pragma warning(pop)
0059 #endif
0060
0061 };
0062
0063 template< class T >
0064 struct remove_nullable
0065 {
0066 typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< is_nullable<T>,
0067 T,
0068 mpl::identity<T> >::type
0069 type;
0070 };
0071
0072 namespace ptr_container_detail
0073 {
0074 template< class T >
0075 struct void_ptr
0076 {
0077 typedef BOOST_DEDUCED_TYPENAME
0078 mpl::if_c< boost::is_const<
0079 BOOST_DEDUCED_TYPENAME boost::remove_nullable<T>::type >::value,
0080 const void*, void* >::type type;
0081 };
0082 }
0083 }
0084
0085 #endif