3 // Copyright Arno Schoedl & Neil Groves 2009.
4 // Use, modification and distribution is subject to the Boost Software
5 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
10 #ifndef BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED
11 #define BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED
13 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
17 #include <boost/config.hpp>
19 #ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
21 #define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \
22 template< typename C > \
23 struct extract_ ## a_typedef \
25 typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \
31 namespace range_detail {
32 template< typename T > struct exists { typedef void type; };
36 // Defines extract_some_typedef<T> which exposes T::some_typedef as
37 // extract_some_typedef<T>::type if T::some_typedef exists. Otherwise
38 // extract_some_typedef<T> is empty.
39 #define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \
40 template< typename C, typename Enable=void > \
41 struct extract_ ## a_typedef \
43 template< typename C > \
44 struct extract_ ## a_typedef< C \
45 , BOOST_DEDUCED_TYPENAME boost::range_detail::exists< BOOST_DEDUCED_TYPENAME C::a_typedef >::type \
47 typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \
52 #endif // include guard