| 1220 | * and @a p dangling references. If the return is by value the compiler takes care of it. |
| 1221 | */ |
| 1222 | class const_iterator { |
| 1223 | using self_type = const_iterator; ///< Self reference type. |
| 1224 | friend class IPSpace; |
| 1225 | |
| 1226 | public: |
| 1227 | using value_type = detail::ip_space_const_value_type<PAYLOAD>; /// Import for API compliance. |
| 1228 | // STL algorithm compliance. |
| 1229 | using iterator_category = std::bidirectional_iterator_tag; |
| 1230 | using pointer = value_type const *; |
| 1231 | using reference = value_type const &; |
| 1232 | using difference_type = int; |
| 1233 | |
| 1234 | /// Default constructor. |
| 1235 | const_iterator() = default; |
| 1236 | |
| 1237 | /// Copy constructor. |
| 1238 | const_iterator(self_type const &that) = default; |
| 1239 | |
| 1240 | /// Assignment. |
| 1241 | self_type &operator=(self_type const &that); |
| 1242 | |
| 1243 | /// Pre-increment. |
| 1244 | /// Move to the next element in the list. |
| 1245 | /// @return The iterator. |
| 1246 | self_type &operator++(); |
| 1247 | |
| 1248 | /// Pre-decrement. |
| 1249 | /// Move to the previous element in the list. |
| 1250 | /// @return The iterator. |
| 1251 | self_type &operator--(); |
| 1252 | |
| 1253 | /// Post-increment. |
| 1254 | /// Move to the next element in the list. |
| 1255 | /// @return The iterator value before the increment. |
| 1256 | self_type operator++(int); |
| 1257 | |
| 1258 | /// Post-decrement. |
| 1259 | /// Move to the previous element in the list. |
| 1260 | /// @return The iterator value before the decrement. |
| 1261 | self_type operator--(int); |
| 1262 | |
| 1263 | /// Dereference. |
| 1264 | /// @return A reference to the referent. |
| 1265 | reference operator*() const; |
| 1266 | |
| 1267 | /// Dereference. |
| 1268 | /// @return A pointer to the referent. |
| 1269 | pointer operator->() const; |
| 1270 | |
| 1271 | /// Equality |
| 1272 | bool operator==(self_type const &that) const; |
| 1273 | |
| 1274 | /// Inequality |
| 1275 | bool operator!=(self_type const &that) const; |
| 1276 | |
| 1277 | protected: |
| 1278 | // These are stored non-const to make implementing @c iterator easier. The containing class provides the |
| 1279 | // required @c const protection. Internally a tuple of iterators is stored for forward iteration. If |