1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/range/detail/begin.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,133 @@
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_BEGIN_HPP
1.15 +#define BOOST_RANGE_DETAIL_BEGIN_HPP
1.16 +
1.17 +#include <boost/config.hpp> // BOOST_MSVC
1.18 +#include <boost/detail/workaround.hpp>
1.19 +#include <boost/range/result_iterator.hpp>
1.20 +#include <boost/range/detail/common.hpp>
1.21 +#if BOOST_WORKAROUND(BOOST_MSVC, < 1310)
1.22 +# include <boost/range/value_type.hpp>
1.23 +#endif
1.24 +
1.25 +namespace boost
1.26 +{
1.27 +
1.28 + namespace range_detail
1.29 + {
1.30 + template< typename T >
1.31 + struct range_begin;
1.32 +
1.33 + //////////////////////////////////////////////////////////////////////
1.34 + // default
1.35 + //////////////////////////////////////////////////////////////////////
1.36 +
1.37 + template<>
1.38 + struct range_begin<std_container_>
1.39 + {
1.40 + template< typename C >
1.41 + static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<C>::type fun( C& c )
1.42 + {
1.43 + return c.begin();
1.44 + };
1.45 + };
1.46 +
1.47 + //////////////////////////////////////////////////////////////////////
1.48 + // pair
1.49 + //////////////////////////////////////////////////////////////////////
1.50 +
1.51 + template<>
1.52 + struct range_begin<std_pair_>
1.53 + {
1.54 + template< typename P >
1.55 + static BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<P>::type fun( const P& p )
1.56 + {
1.57 + return p.first;
1.58 + }
1.59 + };
1.60 +
1.61 + //////////////////////////////////////////////////////////////////////
1.62 + // array
1.63 + //////////////////////////////////////////////////////////////////////
1.64 +
1.65 + template<>
1.66 + struct range_begin<array_>
1.67 + {
1.68 + #if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
1.69 + template< typename T, std::size_t sz >
1.70 + static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
1.71 + {
1.72 + return boost_range_array;
1.73 + }
1.74 + #else
1.75 + template<typename T>
1.76 + static BOOST_RANGE_DEDUCED_TYPENAME range_value<T>::type* fun(T& t)
1.77 + {
1.78 + return t;
1.79 + }
1.80 + #endif
1.81 + };
1.82 +
1.83 + //////////////////////////////////////////////////////////////////////
1.84 + // string
1.85 + //////////////////////////////////////////////////////////////////////
1.86 +
1.87 + template<>
1.88 + struct range_begin<char_ptr_>
1.89 + {
1.90 + static char* fun( char* s )
1.91 + {
1.92 + return s;
1.93 + }
1.94 + };
1.95 +
1.96 + template<>
1.97 + struct range_begin<const_char_ptr_>
1.98 + {
1.99 + static const char* fun( const char* s )
1.100 + {
1.101 + return s;
1.102 + }
1.103 + };
1.104 +
1.105 + template<>
1.106 + struct range_begin<wchar_t_ptr_>
1.107 + {
1.108 +
1.109 + static wchar_t* fun( wchar_t* s )
1.110 + {
1.111 + return s;
1.112 + }
1.113 + };
1.114 +
1.115 + template<>
1.116 + struct range_begin<const_wchar_t_ptr_>
1.117 + {
1.118 + static const wchar_t* fun( const wchar_t* s )
1.119 + {
1.120 + return s;
1.121 + }
1.122 + };
1.123 +
1.124 + } // namespace 'range_detail'
1.125 +
1.126 + template< typename C >
1.127 + inline BOOST_RANGE_DEDUCED_TYPENAME range_result_iterator<C>::type
1.128 + begin( C& c )
1.129 + {
1.130 + return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
1.131 + }
1.132 +
1.133 +} // namespace 'boost'
1.134 +
1.135 +
1.136 +#endif