123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- #ifndef BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP
- #define BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP
- #include <boost/algorithm/string/config.hpp>
- #include <boost/type_traits/is_array.hpp>
- #include <boost/type_traits/is_pointer.hpp>
- #include <boost/mpl/eval_if.hpp>
- #include <boost/range/detail/collection_traits_detail.hpp>
- namespace boost {
- namespace algorithm {
-
-
-
- template< typename T >
- struct collection_traits
- {
- private:
- typedef BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
- ::boost::algorithm::detail::is_pair<T>,
- detail::pair_container_traits_selector<T>,
- BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
- ::boost::is_array<T>,
- detail::array_container_traits_selector<T>,
- BOOST_STRING_TYPENAME ::boost::mpl::eval_if<
- ::boost::is_pointer<T>,
- detail::pointer_container_traits_selector<T>,
- detail::default_container_traits_selector<T>
- >
- >
- >::type container_helper_type;
- public:
-
- typedef container_helper_type function_type;
-
- typedef BOOST_STRING_TYPENAME
- container_helper_type::value_type value_type;
-
- typedef BOOST_STRING_TYPENAME
- container_helper_type::size_type size_type;
-
- typedef BOOST_STRING_TYPENAME
- container_helper_type::iterator iterator;
-
- typedef BOOST_STRING_TYPENAME
- container_helper_type::const_iterator const_iterator;
-
- typedef BOOST_STRING_TYPENAME
- container_helper_type::result_iterator result_iterator;
-
- typedef BOOST_STRING_TYPENAME
- container_helper_type::difference_type difference_type;
- };
-
-
- template< typename C >
- struct value_type_of
- {
- typedef BOOST_STRING_TYPENAME collection_traits<C>::value_type type;
- };
-
-
-
- template< typename C >
- struct difference_type_of
- {
- typedef BOOST_STRING_TYPENAME collection_traits<C>::difference_type type;
- };
-
-
- template< typename C >
- struct iterator_of
- {
- typedef BOOST_STRING_TYPENAME collection_traits<C>::iterator type;
- };
-
-
- template< typename C >
- struct const_iterator_of
- {
- typedef BOOST_STRING_TYPENAME collection_traits<C>::const_iterator type;
- };
-
-
- template< typename C >
- struct result_iterator_of
- {
- typedef BOOST_STRING_TYPENAME collection_traits<C>::result_iterator type;
- };
-
-
- template< typename C >
- inline BOOST_STRING_TYPENAME collection_traits<C>::size_type
- size( const C& c )
- {
- return collection_traits<C>::function_type::size( c );
- }
-
-
- template< typename C >
- inline bool empty( const C& c )
- {
- return collection_traits<C>::function_type::empty( c );
- }
- #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
-
-
- template< typename C >
- inline BOOST_STRING_TYPENAME collection_traits<C>::iterator
- begin( C& c )
- {
- return collection_traits<C>::function_type::begin( c );
- }
-
-
- template< typename C >
- inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator
- begin( const C& c )
- {
- return collection_traits<C>::function_type::begin( c );
- }
-
-
- template< typename C >
- inline BOOST_STRING_TYPENAME collection_traits<C>::iterator
- end( C& c )
- {
- return collection_traits<C>::function_type::end( c );
- }
-
-
- template< typename C >
- inline BOOST_STRING_TYPENAME collection_traits<C>::const_iterator
- end( const C& c )
- {
- return collection_traits<C>::function_type::end( c );
- }
- #else
-
-
- template< typename C >
- inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator
- begin( C& c )
- {
- return collection_traits<C>::function_type::begin( c );
- }
-
-
- template< typename C >
- inline BOOST_STRING_TYPENAME collection_traits<C>::result_iterator
- end( C& c )
- {
- return collection_traits<C>::function_type::end( c );
- }
- #endif
- }
- }
- #endif
|