// 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_END_HPP #define BOOST_RANGE_DETAIL_END_HPP #include #include #include namespace boost { namespace range_detail { template< typename T > struct collection_end; ////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////// template<> struct collection_end { template< typename C > static BOOST_CT_DEDUCED_TYPENAME result_iterator_of::type fun( C& c ) { return c.end(); }; }; ////////////////////////////////////////////////////////////////////// // pair ////////////////////////////////////////////////////////////////////// template<> struct collection_end { template< typename P > static BOOST_CT_DEDUCED_TYPENAME result_iterator_of

::type fun( const P& p ) { return p.second; } }; ////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////// template<> struct collection_end { template< typename T, std::size_t sz > static T* fun( T BOOST_ARRAY_REF[sz] ) { return boost::range_detail::array_end( array ); } }; template<> struct collection_end { template< typename T, std::size_t sz > static std::size_t fun( T BOOST_ARRAY_REF[sz] ) { return boost::range_detail::array_end( array ); } }; template<> struct collection_end { template< typename T, std::size_t sz > static std::size_t fun( T BOOST_ARRAY_REF[sz] ) { return boost::range_detail::array_end( array ); } }; ////////////////////////////////////////////////////////////////////// // string ////////////////////////////////////////////////////////////////////// template<> struct collection_end { static char* fun( char* s ) { return boost::range_detail::str_end( s ); } }; template<> struct collection_end { static const char* fun( const char* s ) { return boost::range_detail::str_end( s ); } }; template<> struct collection_end { static wchar_t* fun( wchar_t* s ) { return boost::range_detail::str_end( s ); } }; template<> struct collection_end { static const wchar_t* fun( const wchar_t* s ) { return boost::range_detail::str_end( s ); } }; } // namespace 'range_detail' template< typename C > inline BOOST_DEDUCED_TYPENAME result_iterator_of::type end( C& c ) { return range_detail::collection_end< BOOST_DEDUCED_TYPENAME range_detail::collection::type >::fun( c ); } } // namespace 'boost' #endif