Chris@16: // Chris@16: // Boost.Pointer Container Chris@16: // Chris@16: // Copyright Thorsten Ottosen 2003-2005. Use, modification and Chris@16: // distribution is subject to the Boost Software License, Version Chris@16: // 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // For more information, see http://www.boost.org/libs/ptr_container/ Chris@16: // Chris@16: Chris@16: Chris@16: #ifndef BOOST_INDIRECT_CONTAINER_NULLABLE_HPP Chris@16: #define BOOST_INDIRECT_CONTAINER_NULLABLE_HPP Chris@16: Chris@16: #if defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost Chris@16: { Chris@16: Chris@16: template< class T > Chris@16: struct nullable Chris@16: { Chris@16: typedef T type; Chris@16: }; Chris@16: Chris@16: namespace ptr_container_detail Chris@16: { Chris@16: template< class T > Chris@16: type_traits::yes_type is_nullable( const nullable* ); Chris@16: Chris@16: type_traits::no_type is_nullable( ... ); Chris@16: } Chris@16: Chris@16: template< class T > Chris@16: struct is_nullable Chris@16: { Chris@16: private: Chris@16: BOOST_STATIC_CONSTANT( T*, var ); Chris@16: public: Chris@16: Chris@16: #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) Chris@16: #pragma warning(push) Chris@16: #pragma warning(disable:6334) Chris@16: #endif Chris@16: Chris@16: BOOST_STATIC_CONSTANT(bool, value = sizeof( ptr_container_detail::is_nullable( var ) ) Chris@16: == sizeof( type_traits::yes_type ) ); Chris@16: #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) Chris@16: #pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: }; Chris@16: Chris@16: template< class T > Chris@16: struct remove_nullable Chris@16: { Chris@16: typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< is_nullable, Chris@16: T, Chris@16: mpl::identity >::type Chris@16: type; Chris@16: }; Chris@16: Chris@16: } Chris@16: Chris@16: #endif