epoc32/include/stdapis/boost/range/detail/common.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/range/detail/common.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,116 @@
     1.4 +// Boost.Range library
     1.5 +//
     1.6 +//  Copyright Thorsten Ottosen 2003-2004. Use, modification and
     1.7 +//  distribution is subject to the Boost Software License, Version
     1.8 +//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
     1.9 +//  http://www.boost.org/LICENSE_1_0.txt)
    1.10 +//
    1.11 +// For more information, see http://www.boost.org/libs/range/
    1.12 +//
    1.13 +
    1.14 +#ifndef BOOST_RANGE_DETAIL_COMMON_HPP
    1.15 +#define BOOST_RANGE_DETAIL_COMMON_HPP
    1.16 +
    1.17 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
    1.18 +# pragma once
    1.19 +#endif
    1.20 +
    1.21 +#include <boost/range/config.hpp>
    1.22 +#include <boost/range/detail/sfinae.hpp>
    1.23 +#include <boost/type_traits/is_void.hpp>
    1.24 +#include <boost/type_traits/detail/ice_or.hpp>
    1.25 +#include <boost/mpl/if.hpp>
    1.26 +#include <boost/mpl/int.hpp>
    1.27 +#include <cstddef>
    1.28 +
    1.29 +//////////////////////////////////////////////////////////////////////////////
    1.30 +// missing partial specialization  workaround.
    1.31 +//////////////////////////////////////////////////////////////////////////////
    1.32 +
    1.33 +namespace boost 
    1.34 +{
    1.35 +    namespace range_detail 
    1.36 +    {        
    1.37 +        // 1 = std containers
    1.38 +        // 2 = std::pair
    1.39 +        // 3 = const std::pair
    1.40 +        // 4 = array
    1.41 +        // 5 = const array
    1.42 +        // 6 = char array
    1.43 +        // 7 = wchar_t array
    1.44 +        // 8 = char*
    1.45 +        // 9 = const char*
    1.46 +        // 10 = whar_t*
    1.47 +        // 11 = const wchar_t*
    1.48 +        // 12 = string
    1.49 +        
    1.50 +        typedef mpl::int_<1>::type    std_container_;
    1.51 +        typedef mpl::int_<2>::type    std_pair_;
    1.52 +        typedef mpl::int_<3>::type    const_std_pair_;
    1.53 +        typedef mpl::int_<4>::type    array_;
    1.54 +        typedef mpl::int_<5>::type    const_array_;
    1.55 +        typedef mpl::int_<6>::type    char_array_;
    1.56 +        typedef mpl::int_<7>::type    wchar_t_array_;
    1.57 +        typedef mpl::int_<8>::type    char_ptr_;
    1.58 +        typedef mpl::int_<9>::type    const_char_ptr_;
    1.59 +        typedef mpl::int_<10>::type   wchar_t_ptr_;
    1.60 +        typedef mpl::int_<11>::type   const_wchar_t_ptr_;
    1.61 +        typedef mpl::int_<12>::type   string_;
    1.62 +        
    1.63 +        template< typename C >
    1.64 +        struct range_helper
    1.65 +        {
    1.66 +            static C* c;
    1.67 +            static C  ptr;
    1.68 +
    1.69 +            BOOST_STATIC_CONSTANT( bool, is_pair_                = sizeof( boost::range_detail::is_pair_impl( c ) ) == sizeof( yes_type ) );
    1.70 +            BOOST_STATIC_CONSTANT( bool, is_char_ptr_            = sizeof( boost::range_detail::is_char_ptr_impl( ptr ) ) == sizeof( yes_type ) );
    1.71 +            BOOST_STATIC_CONSTANT( bool, is_const_char_ptr_      = sizeof( boost::range_detail::is_const_char_ptr_impl( ptr ) ) == sizeof( yes_type ) );
    1.72 +            BOOST_STATIC_CONSTANT( bool, is_wchar_t_ptr_         = sizeof( boost::range_detail::is_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) );
    1.73 +            BOOST_STATIC_CONSTANT( bool, is_const_wchar_t_ptr_   = sizeof( boost::range_detail::is_const_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) );
    1.74 +            BOOST_STATIC_CONSTANT( bool, is_char_array_          = sizeof( boost::range_detail::is_char_array_impl( ptr ) ) == sizeof( yes_type ) );
    1.75 +            BOOST_STATIC_CONSTANT( bool, is_wchar_t_array_       = sizeof( boost::range_detail::is_wchar_t_array_impl( ptr ) ) == sizeof( yes_type ) );
    1.76 +            BOOST_STATIC_CONSTANT( bool, is_string_              = (boost::type_traits::ice_or<is_const_char_ptr_, is_const_wchar_t_ptr_>::value ));
    1.77 +            BOOST_STATIC_CONSTANT( bool, is_array_               = boost::is_array<C>::value );
    1.78 +            
    1.79 +        };
    1.80 +        
    1.81 +        template< typename C >
    1.82 +        class range
    1.83 +        {
    1.84 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_pair_,
    1.85 +                                                                  boost::range_detail::std_pair_,
    1.86 +                                                                  void >::type pair_t;
    1.87 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_array_,
    1.88 +                                                                    boost::range_detail::array_,
    1.89 +                                                                    pair_t >::type array_t;
    1.90 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_string_,
    1.91 +                                                                    boost::range_detail::string_,
    1.92 +                                                                    array_t >::type string_t;
    1.93 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_const_char_ptr_,
    1.94 +                                                                    boost::range_detail::const_char_ptr_,
    1.95 +                                                                    string_t >::type const_char_ptr_t;
    1.96 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_char_ptr_,
    1.97 +                                                                    boost::range_detail::char_ptr_,
    1.98 +                                                                    const_char_ptr_t >::type char_ptr_t;
    1.99 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_const_wchar_t_ptr_,
   1.100 +                                                                    boost::range_detail::const_wchar_t_ptr_,
   1.101 +                                                                    char_ptr_t >::type const_wchar_ptr_t;
   1.102 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_wchar_t_ptr_,
   1.103 +                                                                    boost::range_detail::wchar_t_ptr_,
   1.104 +                                                                    const_wchar_ptr_t >::type wchar_ptr_t;
   1.105 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_wchar_t_array_,
   1.106 +                                                                    boost::range_detail::wchar_t_array_,
   1.107 +                                                                    wchar_ptr_t >::type wchar_array_t;
   1.108 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::range_detail::range_helper<C>::is_char_array_,
   1.109 +                                                                    boost::range_detail::char_array_,
   1.110 +                                                                    wchar_array_t >::type char_array_t;
   1.111 +        public:
   1.112 +            typedef BOOST_RANGE_DEDUCED_TYPENAME   boost::mpl::if_c< ::boost::is_void<char_array_t>::value,
   1.113 +                                                                    boost::range_detail::std_container_,
   1.114 +                                                                    char_array_t >::type type;  
   1.115 +        }; // class 'range' 
   1.116 +    }
   1.117 +}
   1.118 +        
   1.119 +#endif