00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00048 #ifndef STLSOFT_INCL_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_KEY_SEQUENCE
00049 #define STLSOFT_INCL_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_KEY_SEQUENCE
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_KEY_SEQUENCE_MAJOR 2
00053 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_KEY_SEQUENCE_MINOR 1
00054 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_KEY_SEQUENCE_REVISION 1
00055 # define STLSOFT_VER_STLSOFT_COLLECTIONS_HPP_ASSOCIATIVE_KEY_SEQUENCE_EDIT 24
00056 #endif
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00073 # include <stlsoft/stlsoft.h>
00074 #endif
00075 #ifndef STLSOFT_INCL_STLSOFT_ITERATORS_HPP_ASSOCIATIVE_SELECT_ITERATOR
00076 # include <stlsoft/iterators/associative_select_iterator.hpp>
00077 #endif
00078 #ifndef STLSOFT_INCL_STLSOFT_COLLECTIONS_UTIL_HPP_COLLECTIONS
00079 # include <stlsoft/collections/util/collections.hpp>
00080 #endif
00081 #ifndef STLSOFT_INCL_STLSOFT_UTIL_STD_HPP_ITERATOR_HELPER
00082 # include <stlsoft/util/std/iterator_helper.hpp>
00083 #endif
00084
00085 #ifndef STLSOFT_INCL_STDEXCEPT
00086 # define STLSOFT_INCL_STDEXCEPT
00087 # include <stdexcept>
00088 #endif
00089
00090 #ifdef STLSOFT_UNITTEST
00091 # include <map>
00092 #endif
00093
00094
00095
00096
00097
00098 #ifndef _STLSOFT_NO_NAMESPACE
00099 namespace stlsoft
00100 {
00101 #endif
00102
00103
00104
00105
00106
00111 template <ss_typename_param_k A>
00112 class associative_key_sequence
00113 : public stl_collection_tag
00114 {
00117 public:
00119 typedef associative_key_sequence<A> class_type;
00121 #if 0
00122 typedef ss_typename_type_k A::mapped_type value_type;
00123 #else
00124 typedef ss_typename_type_k A::value_type::first_type value_type;
00125 #endif
00127 typedef A associative_container_type;
00129 typedef ss_typename_type_k A::allocator_type allocator_type;
00130 #if 0
00135 typedef ss_typename_type_k A::const_pointer pointer;
00137 typedef ss_typename_type_k A::const_pointer const_pointer;
00138 #endif
00143 typedef ss_typename_type_k A::const_reference reference;
00145 typedef ss_typename_type_k A::const_reference const_reference;
00147 typedef ss_typename_type_k A::size_type size_type;
00149 typedef ss_typename_type_k A::difference_type difference_type;
00150
00152 private:
00153 typedef ss_typename_type_k A::iterator A_iterator_type;
00154 typedef ss_typename_type_k A::const_iterator A_const_iterator_type;
00155 typedef ss_typename_type_k A::value_type A_value_type;
00156 typedef ::stlsoft::select_first<A_value_type> select_first_type;
00157
00158
00159 public:
00160 typedef associative_select_iterator < A_iterator_type
00161 , select_first_type
00162 > iterator;
00164 typedef associative_select_iterator < A_const_iterator_type
00165 , select_first_type
00166 > const_iterator;
00167
00168 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00170 typedef reverse_iterator_base < iterator
00171 , value_type
00172 , reference
00173 , value_type*
00174 , difference_type
00175 > reverse_iterator;
00176
00178 typedef const_reverse_iterator_base < const_iterator
00179 , value_type const
00180 , const_reference
00181 , value_type const*
00182 , difference_type
00183 > const_reverse_iterator;
00184 #endif
00186
00189 public:
00190 ss_explicit_k associative_key_sequence(associative_container_type const& container);
00192
00195 public:
00197 size_type size() const;
00199 size_type max_size() const;
00201 ss_bool_t empty() const;
00203
00206 public:
00210 const_iterator begin() const;
00214 const_iterator end() const;
00215
00216 #if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00220 const_reverse_iterator rbegin() const;
00224 const_reverse_iterator rend() const;
00225 #endif
00227
00230 private:
00231 associative_container_type const &m_container;
00233 };
00234
00235
00236
00237
00238
00239 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00240
00241
00242
00243 template <ss_typename_param_k A>
00244 inline associative_key_sequence<A>::associative_key_sequence(ss_typename_type_k associative_key_sequence<A>::associative_container_type const& container)
00245 : m_container(container)
00246 {}
00247
00248
00249
00250 template <ss_typename_param_k A>
00251 inline ss_typename_type_ret_k associative_key_sequence<A>::size_type associative_key_sequence<A>::size() const
00252 {
00253 return m_container.size();
00254 }
00255
00256 template <ss_typename_param_k A>
00257 inline ss_typename_type_ret_k associative_key_sequence<A>::size_type associative_key_sequence<A>::max_size() const
00258 {
00259 return m_container.max_size();
00260 }
00261
00262 template <ss_typename_param_k A>
00263 inline ss_bool_t associative_key_sequence<A>::empty() const
00264 {
00265 return m_container.empty();
00266 }
00267
00268
00269
00270 template <ss_typename_param_k A>
00271 inline ss_typename_type_ret_k associative_key_sequence<A>::const_iterator associative_key_sequence<A>::begin() const
00272 {
00273 return const_iterator(m_container.begin());
00274 }
00275
00276 template <ss_typename_param_k A>
00277 inline ss_typename_type_ret_k associative_key_sequence<A>::const_iterator associative_key_sequence<A>::end() const
00278 {
00279 return const_iterator(m_container.end());
00280 }
00281
00282 # if defined(STLSOFT_LF_BIDIRECTIONAL_ITERATOR_SUPPORT)
00283 template <ss_typename_param_k A>
00284 inline ss_typename_type_ret_k associative_key_sequence<A>::const_reverse_iterator associative_key_sequence<A>::rbegin() const
00285 {
00286 return const_reverse_iterator(m_container.rbegin());
00287 }
00288
00289 template <ss_typename_param_k A>
00290 inline ss_typename_type_ret_k associative_key_sequence<A>::const_reverse_iterator associative_key_sequence<A>::rend() const
00291 {
00292 return const_reverse_iterator(m_container.rend());
00293 }
00294 # endif
00295
00296 #endif
00297
00298
00299
00300 #ifndef _STLSOFT_NO_NAMESPACE
00301 }
00302 #endif
00303
00304
00305
00306 #endif
00307
00308