// Boost.Range library // // Copyright Thorsten Ottosen 2003-2004. Use, modification and // distribution is subject to the Boost Software License, Version // 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // For more information, see http://www.boost.org/libs/range/ // #ifndef BOOST_RANGE_DETAIL_BEGIN_HPP #define BOOST_RANGE_DETAIL_BEGIN_HPP #include #include namespace boost { namespace range_detail { template< typename T > struct range_begin; ////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////// template<> struct range_begin { template< typename C > static BOOST_CT_DEDUCED_TYPENAME result_iterator_of::type fun( C& c ) { return c.begin(); }; }; ////////////////////////////////////////////////////////////////////// // pair ////////////////////////////////////////////////////////////////////// template<> struct range_begin { template< typename P > static BOOST_CT_DEDUCED_TYPENAME result_iterator_of

::type fun( const P& p ) { return p.first; } }; ////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////// template<> struct range_begin { template< typename T, std::size_t sz > static T* fun( T BOOST_ARRAY_REF[sz] ) { return array; } }; ////////////////////////////////////////////////////////////////////// // string ////////////////////////////////////////////////////////////////////// template<> struct range_begin { static char* fun( char* s ) { return s; } }; template<> struct range_begin { static const char* fun( const char* s ) { return s; } }; template<> struct range_begin { static wchar_t* fun( wchar_t* s ) { return s; } }; template<> struct range_begin { static const wchar_t* fun( const wchar_t* s ) { return s; } }; } // namespace 'range_traits_detail' template< typename C > inline BOOST_DEDUCED_TYPENAME result_iterator_of::type begin( C& c ) { return range_traits_detail::range_begin< BOOST_DEDUCED_TYPENAME range_traits_detail::range::type >::fun( c ); } } // namespace 'boost' #endif