Warning, file /include/boost/range/detail/collection_traits.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP
0023 #define BOOST_RANGE_STRING_COLLECTION_TRAITS_HPP
0024
0025 #include <boost/type_traits/is_array.hpp>
0026 #include <boost/type_traits/is_pointer.hpp>
0027 #include <boost/mpl/eval_if.hpp>
0028
0029
0030 #include <boost/range/detail/collection_traits_detail.hpp>
0031
0032
0033
0034
0035
0036
0037
0038
0039 namespace boost {
0040 namespace algorithm {
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 template< typename T >
0073 struct collection_traits
0074 {
0075 private:
0076 typedef typename ::boost::mpl::eval_if<
0077 ::boost::algorithm::detail::is_pair<T>,
0078 detail::pair_container_traits_selector<T>,
0079 typename ::boost::mpl::eval_if<
0080 ::boost::is_array<T>,
0081 detail::array_container_traits_selector<T>,
0082 typename ::boost::mpl::eval_if<
0083 ::boost::is_pointer<T>,
0084 detail::pointer_container_traits_selector<T>,
0085 detail::default_container_traits_selector<T>
0086 >
0087 >
0088 >::type container_helper_type;
0089 public:
0090
0091 typedef container_helper_type function_type;
0092
0093 typedef typename
0094 container_helper_type::value_type value_type;
0095
0096 typedef typename
0097 container_helper_type::size_type size_type;
0098
0099 typedef typename
0100 container_helper_type::iterator iterator;
0101
0102 typedef typename
0103 container_helper_type::const_iterator const_iterator;
0104
0105 typedef typename
0106 container_helper_type::result_iterator result_iterator;
0107
0108 typedef typename
0109 container_helper_type::difference_type difference_type;
0110
0111 };
0112
0113
0114
0115
0116
0117
0118
0119 template< typename C >
0120 struct value_type_of
0121 {
0122 typedef typename collection_traits<C>::value_type type;
0123 };
0124
0125
0126
0127
0128
0129 template< typename C >
0130 struct difference_type_of
0131 {
0132 typedef typename collection_traits<C>::difference_type type;
0133 };
0134
0135
0136
0137
0138
0139 template< typename C >
0140 struct iterator_of
0141 {
0142 typedef typename collection_traits<C>::iterator type;
0143 };
0144
0145
0146
0147
0148
0149 template< typename C >
0150 struct const_iterator_of
0151 {
0152 typedef typename collection_traits<C>::const_iterator type;
0153 };
0154
0155
0156
0157
0158
0159
0160
0161 template< typename C >
0162 struct result_iterator_of
0163 {
0164 typedef typename collection_traits<C>::result_iterator type;
0165 };
0166
0167
0168
0169
0170
0171
0172
0173 template< typename C >
0174 inline typename collection_traits<C>::size_type
0175 size( const C& c )
0176 {
0177 return collection_traits<C>::function_type::size( c );
0178 }
0179
0180
0181
0182
0183
0184 template< typename C >
0185 inline bool empty( const C& c )
0186 {
0187 return collection_traits<C>::function_type::empty( c );
0188 }
0189
0190
0191
0192
0193
0194 template< typename C >
0195 inline typename collection_traits<C>::iterator
0196 begin( C& c )
0197 {
0198 return collection_traits<C>::function_type::begin( c );
0199 }
0200
0201
0202
0203
0204
0205 template< typename C >
0206 inline typename collection_traits<C>::const_iterator
0207 begin( const C& c )
0208 {
0209 return collection_traits<C>::function_type::begin( c );
0210 }
0211
0212
0213
0214
0215
0216 template< typename C >
0217 inline typename collection_traits<C>::iterator
0218 end( C& c )
0219 {
0220 return collection_traits<C>::function_type::end( c );
0221 }
0222
0223
0224
0225
0226
0227 template< typename C >
0228 inline typename collection_traits<C>::const_iterator
0229 end( const C& c )
0230 {
0231 return collection_traits<C>::function_type::end( c );
0232 }
0233
0234 }
0235 }
0236
0237 #endif