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
00045 #define PB_ASSOC_IT_C_DEC \
00046 it_< \
00047 It0, \
00048 It1, \
00049 Has_Data, \
00050 Const>
00051
00052 #define PB_ASSOC_OIT_T_DEC \
00053 template<class OIt0, class OIt1, bool OHas_Data, bool OConst>
00054
00055 #define PB_ASSOC_OIT_C_DEC \
00056 it_< \
00057 OIt0, \
00058 OIt1, \
00059 OHas_Data, \
00060 OConst>
00061
00062 template<class It0, class It1, bool Has_Data, bool Const>
00063 class it_
00064 {
00065 public:
00066
00067 typedef typename it_value_type_traits_t::value_type value_type;
00068
00069 typedef typename it_value_type_traits_t::reference reference;
00070
00071 typedef
00072 typename it_value_type_traits_t::const_reference
00073 const_reference;
00074
00075 typedef typename it_value_type_traits_t::pointer pointer;
00076
00077 typedef typename it_value_type_traits_t::const_pointer const_pointer;
00078
00079 public:
00080 inline
00081 it_(It0 it0 = It0(),
00082 It0 end_it0 = It0(),
00083 It1 it1 = It1()) : m_it0(it0),
00084 m_end_it0(end_it0),
00085 m_it1(it1)
00086 { }
00087
00088 inline
00089 it_(const PB_ASSOC_IT_C_DEC& r_other) : m_it0(r_other.m_it0),
00090 m_end_it0(r_other.m_end_it0),
00091 m_it1(r_other.m_it1)
00092 { }
00093
00094 PB_ASSOC_OIT_T_DEC
00095 inline
00096 it_(const PB_ASSOC_OIT_C_DEC& r_other) : m_it0(r_other.m_it0),
00097 m_end_it0(r_other.m_end_it0),
00098 m_it1(r_other.m_it1)
00099 { }
00100
00101 inline bool
00102 operator==(const PB_ASSOC_IT_C_DEC& r_other) const
00103 {
00104 if (m_it0 != r_other.m_it0)
00105 return (false);
00106
00107 if (m_it0 == m_end_it0)
00108 return (true);
00109
00110 return (m_it1 == r_other.m_it1);
00111 }
00112
00113 inline bool
00114 operator!=(const PB_ASSOC_IT_C_DEC& r_other) const
00115 {
00116 return (!operator==(r_other));
00117 }
00118
00119 inline PB_ASSOC_IT_C_DEC&
00120 operator++()
00121 {
00122 ++m_it1;
00123
00124 if (m_it1 == m_it0->second.end())
00125 do
00126 {
00127 ++m_it0;
00128 }
00129 while (m_it0 != m_end_it0&& m_it0->second.empty());
00130
00131 if (m_it0 != m_end_it0&& !m_it0->second.empty())
00132 m_it1 = m_it0->second.begin();
00133
00134 return (*this);
00135 }
00136
00137 inline PB_ASSOC_IT_C_DEC
00138 operator++(int)
00139 {
00140 PB_ASSOC_IT_C_DEC ret =* this;
00141
00142 operator++();
00143
00144 return (ret);
00145 }
00146
00147 inline const_pointer
00148 operator->() const
00149 {
00150 it_value_type_traits_t::make_valid(m_value_type_holder, m_it0->first, * m_it1);
00151
00152 return (it_value_type_traits_t::recast(m_value_type_holder));
00153 }
00154
00155 inline pointer
00156 operator->()
00157 {
00158
00159
00160 it_value_type_traits_t::make_valid(m_value_type_holder, m_it0->first, * m_it1);
00161
00162 return (it_value_type_traits_t::recast(m_value_type_holder));
00163 }
00164
00165 inline const_reference
00166 operator*() const
00167 {
00168 return (*operator->());
00169 }
00170
00171 inline reference
00172 operator*()
00173 {
00174 PB_ASSOC_STATIC_ASSERT(non_const, !Const);
00175
00176 return (*operator->());
00177 }
00178
00179 public:
00180 mutable It0 m_it0;
00181 It0 m_end_it0;
00182
00183 mutable It1 m_it1;
00184
00185 int_to_type<Has_Data> m_has_data;
00186
00187 private:
00188 mutable typename it_value_type_traits_t::value_type_holder m_value_type_holder;
00189 };
00190
00191 #undef PB_ASSOC_IT_C_DEC
00192
00193 #undef PB_ASSOC_OIT_T_DEC
00194
00195 #undef PB_ASSOC_OIT_C_DEC
00196