LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+f5613e8b4f,g1470d8bcf6+190ad2ba91,g14a832a312+311607e4ab,g2079a07aa2+86d27d4dc4,g2305ad1205+a8e3196225,g295015adf3+b67ee847e5,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+a761f810f3,g487adcacf7+17c8fdbcbd,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+65b5bd823e,g5a732f18d5+53520f316c,g64a986408d+f5613e8b4f,g6c1bc301e9+51106c2951,g858d7b2824+f5613e8b4f,g8a8a8dda67+585e252eca,g99cad8db69+6729933424,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+ef4e3a5875,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e9bba80f27,gc120e1dc64+eee469a5e5,gc28159a63d+0e5473021a,gcf0d15dbbd+a761f810f3,gdaeeff99f8+f9a426f77a,ge6526c86ff+d4c1d4bfef,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf1cff7945b+f5613e8b4f,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
lsst::sphgeom::RangeSet::Iterator Struct Reference

A constant iterator over the ranges (represented as 2-tuples) in a RangeSet. More...

#include <RangeSet.h>

Public Types

using difference_type = ptrdiff_t
 
using value_type = std::tuple<uint64_t, uint64_t>
 
using pointer = void
 
using reference = std::tuple<uint64_t, uint64_t>
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 Iterator ()=default
 
 Iterator (uint64_t const *ptr)
 
Iteratoroperator++ ()
 
Iteratoroperator-- ()
 
Iterator operator++ (int)
 
Iterator operator-- (int)
 
Iterator operator+ (ptrdiff_t n) const
 
Iterator operator- (ptrdiff_t n) const
 
Iteratoroperator+= (ptrdiff_t n)
 
Iteratoroperator-= (ptrdiff_t n)
 
ptrdiff_t operator- (Iterator const &i) const
 
bool operator== (Iterator const &i) const
 
bool operator!= (Iterator const &i) const
 
bool operator< (Iterator const &i) const
 
bool operator> (Iterator const &i) const
 
bool operator<= (Iterator const &i) const
 
bool operator>= (Iterator const &i) const
 
std::tuple< uint64_t, uint64_t > operator* ()
 
std::tuple< uint64_t, uint64_t > operator[] (ptrdiff_t n) const
 

Public Attributes

uint64_t const * p = nullptr
 

Friends

void swap (Iterator &a, Iterator &b)
 
Iterator operator+ (ptrdiff_t n, Iterator const &i)
 

Detailed Description

A constant iterator over the ranges (represented as 2-tuples) in a RangeSet.

RangeSet does not store an array of 2-tuples internally. But, ยง24.2.5 of the C++11 standard requires the following from constant forward iterators:

So, dereferencing a forward iterator cannot return by value, or return a reference to a member of the iterator itself. As a result, it seems impossible to provide more than an input iterator for container objects that do not store their values directly.

While this class only claims to be an input iterator, it nevertheless implements most random access iterator requirements. Dereferencing an iterator returns a tuple by value, and operator-> is omitted.

Definition at line 129 of file RangeSet.h.

Member Typedef Documentation

◆ difference_type

Definition at line 131 of file RangeSet.h.

◆ iterator_category

Definition at line 135 of file RangeSet.h.

◆ pointer

Definition at line 133 of file RangeSet.h.

◆ reference

Definition at line 134 of file RangeSet.h.

◆ value_type

Definition at line 132 of file RangeSet.h.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

lsst::sphgeom::RangeSet::Iterator::Iterator ( )
default

◆ Iterator() [2/2]

lsst::sphgeom::RangeSet::Iterator::Iterator ( uint64_t const * ptr)
inlineexplicit

Definition at line 138 of file RangeSet.h.

138: p{ptr} {}
uint64_t * ptr
Definition RangeSet.cc:95

Member Function Documentation

◆ operator!=()

bool lsst::sphgeom::RangeSet::Iterator::operator!= ( Iterator const & i) const
inline

Definition at line 165 of file RangeSet.h.

165{ return p != i.p; }

◆ operator*()

std::tuple< uint64_t, uint64_t > lsst::sphgeom::RangeSet::Iterator::operator* ( )
inline

Definition at line 171 of file RangeSet.h.

171 {
172 return std::make_tuple(p[0], p[1]);
173 }
T make_tuple(T... args)

◆ operator+()

Iterator lsst::sphgeom::RangeSet::Iterator::operator+ ( ptrdiff_t n) const
inline

Definition at line 151 of file RangeSet.h.

151{ return Iterator(p + 2 * n); }

◆ operator++() [1/2]

Iterator & lsst::sphgeom::RangeSet::Iterator::operator++ ( )
inline

Definition at line 145 of file RangeSet.h.

145{ p += 2; return *this; }

◆ operator++() [2/2]

Iterator lsst::sphgeom::RangeSet::Iterator::operator++ ( int )
inline

Definition at line 148 of file RangeSet.h.

148{ Iterator i(*this); p += 2; return i; }

◆ operator+=()

Iterator & lsst::sphgeom::RangeSet::Iterator::operator+= ( ptrdiff_t n)
inline

Definition at line 154 of file RangeSet.h.

154{ p += 2 * n; return *this; }

◆ operator-() [1/2]

ptrdiff_t lsst::sphgeom::RangeSet::Iterator::operator- ( Iterator const & i) const
inline

Definition at line 161 of file RangeSet.h.

161{ return (p - i.p) / 2; }

◆ operator-() [2/2]

Iterator lsst::sphgeom::RangeSet::Iterator::operator- ( ptrdiff_t n) const
inline

Definition at line 152 of file RangeSet.h.

152{ return Iterator(p + 2 * n); }

◆ operator--() [1/2]

Iterator & lsst::sphgeom::RangeSet::Iterator::operator-- ( )
inline

Definition at line 146 of file RangeSet.h.

146{ p -= 2; return *this; }

◆ operator--() [2/2]

Iterator lsst::sphgeom::RangeSet::Iterator::operator-- ( int )
inline

Definition at line 149 of file RangeSet.h.

149{ Iterator i(*this); p -= 2; return i; }

◆ operator-=()

Iterator & lsst::sphgeom::RangeSet::Iterator::operator-= ( ptrdiff_t n)
inline

Definition at line 155 of file RangeSet.h.

155{ p -= 2 * n; return *this; }

◆ operator<()

bool lsst::sphgeom::RangeSet::Iterator::operator< ( Iterator const & i) const
inline

Definition at line 166 of file RangeSet.h.

166{ return p < i.p; }

◆ operator<=()

bool lsst::sphgeom::RangeSet::Iterator::operator<= ( Iterator const & i) const
inline

Definition at line 168 of file RangeSet.h.

168{ return p <= i.p; }

◆ operator==()

bool lsst::sphgeom::RangeSet::Iterator::operator== ( Iterator const & i) const
inline

Definition at line 164 of file RangeSet.h.

164{ return p == i.p; }

◆ operator>()

bool lsst::sphgeom::RangeSet::Iterator::operator> ( Iterator const & i) const
inline

Definition at line 167 of file RangeSet.h.

167{ return p > i.p; }

◆ operator>=()

bool lsst::sphgeom::RangeSet::Iterator::operator>= ( Iterator const & i) const
inline

Definition at line 169 of file RangeSet.h.

169{ return p >= i.p; }

◆ operator[]()

std::tuple< uint64_t, uint64_t > lsst::sphgeom::RangeSet::Iterator::operator[] ( ptrdiff_t n) const
inline

Definition at line 175 of file RangeSet.h.

175 {
176 return std::make_tuple(p[2 * n], p[2 * n + 1]);
177 }

Friends And Related Symbol Documentation

◆ operator+

Iterator operator+ ( ptrdiff_t n,
Iterator const & i )
friend

Definition at line 157 of file RangeSet.h.

157 {
158 return i + n;
159 }

◆ swap

void swap ( Iterator & a,
Iterator & b )
friend

Definition at line 140 of file RangeSet.h.

140 {
141 std::swap(a.p, b.p);
142 }
table::Key< int > b
T swap(T... args)

Member Data Documentation

◆ p

uint64_t const* lsst::sphgeom::RangeSet::Iterator::p = nullptr

Definition at line 179 of file RangeSet.h.


The documentation for this struct was generated from the following file: