12#ifndef OPENVPN_ADDR_RANGE_H
13#define OPENVPN_ADDR_RANGE_H
63template <
typename ADDR>
110 const ADDR &
start()
const;
116 std::size_t
extent()
const;
154template <
typename ADDR>
170 const ADDR &addr()
const;
198 bool operator!=(
const Iterator &rhs)
const;
224template <
typename ADDR>
253template <
typename ADDR>
259template <
typename ADDR>
265template <
typename ADDR>
275template <
typename ADDR>
282template <
typename ADDR>
288template <
typename ADDR>
294template <
typename ADDR>
300template <
typename ADDR>
302 : start_(start), extent_(extent)
306template <
typename ADDR>
312template <
typename ADDR>
321template <
typename ADDR>
327template <
typename ADDR>
333template <
typename ADDR>
339template <
typename ADDR>
345template <
typename ADDR>
348 if (extent > extent_)
356template <
typename ADDR>
359 std::ostringstream
os;
360 os << start_.to_string() <<
'[' << extent_ <<
']';
364template <
typename ADDR>
367 remaining(n_partitions)
371template <
typename ADDR>
377 r = range.
pull_front(range.extent() / remaining);
divide a range of IP addresses into smaller, equal-sized partitions
bool next(RangeType< ADDR > &r)
Retrieves the next partition in the range.
RangePartitionType(const RangeType< ADDR > &src_range, const std::size_t n_partitions)
Constructor for RangePartitionType.
allow easy navigation through a series of IP addresses
Iterator & operator++()
Prefix increment operator.
const ADDR & addr() const
Get the current address in the range.
bool more() const
Check if there are more elements in the range.
const ADDR & operator*() const
Dereference operator.
void next()
Move to the next address in the range.
Iterator(const RangeType &range)
Constructor for the Iterator class.
bool operator!=(const Iterator &rhs) const
Inequality comparison operator.
designed to represent and manage a range of IP addresses.
Iterator iterator() const
Get an iterator for the range.
Iterator end() const
Get an iterator pointing to the end of the range.
bool defined() const
Check if the range is defined (non-empty).
Iterator begin() const
Get an iterator pointing to the beginning of the range.
RangeType()
Default constructor for RangeType.
const ADDR & start() const
Get the starting address of the range.
std::size_t extent() const
Get the extent (size) of the range.
std::string to_string() const
Convert the range to a string representation.
RangeType pull_front(std::size_t extent)
Remove and return a new range from the front of this range.
constexpr BaseT operator*(IntrinsicType< BaseT, T > lhs, IntrinsicType< BaseT, T > rhs) noexcept
Multiplication operator.