65 #ifndef Foam_Circulator_H 66 #define Foam_Circulator_H 68 #include <type_traits> 107 template<
class Container,
bool Const>
108 class CirculatorIters
110 public CirculatorBase
123 using iterator =
typename std::conditional
126 typename Container::const_iterator,
127 typename Container::iterator
131 using reference =
typename std::conditional
134 typename Container::const_reference,
135 typename Container::reference
189 inline bool empty()
const;
245 inline bool operator==
252 inline bool operator!=
276 template<
class Container>
297 const typename Container::iterator&
begin,
298 const typename Container::iterator&
end 305 Circulator(
const Circulator<Container>& rhs) =
default;
311 Circulator<Container>&
operator=
313 const Circulator<Container>& rhs
323 template<
class Container>
324 class ConstCirculator
326 public CirculatorIters<Container, true>
344 const typename Container::const_iterator&
begin,
345 const typename Container::const_iterator&
end reference prev() const
Dereference the previous iterator.
CirculatorIters< Container, Const > & operator--()
Prefix decrement the iterator.
typename Container::difference_type difference_type
The type that represents difference between iterator objects.
void operator=(const CirculatorIters< Container, Const > &rhs)
Assignment operator for circulators operating on the same container type.
CirculatorBase()=default
Default construct.
direction
Direction type enumeration.
CirculatorIters()
Default construct.
void setFulcrumToIterator()
Set the fulcrum to the current position of the iterator.
void setIteratorToFulcrum()
Set the iterator to the current position of the fulcrum.
void decrement()
Move iterator backward.
difference_type nRotations() const
The distance between the iterator and the fulcrum.
reference curr() const
Dereference the current iterator.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
bool equal(const CirculatorIters< Container, Const > &rhs)
Compare for equality.
reference operator()() const
Dereference the iterator. Same as curr()
A pair of begin/end iterators used for implementing circular iteration.
reference operator*() const
Dereference the iterator. Same as curr()
CirculatorIters< Container, Const > & operator++()
Prefix increment the iterator.
void increment()
Move iterator forward.
size_type size() const
Return the range of the iterator pair.
graph_traits< Graph >::vertices_size_type size_type
Circulator()=default
Default construct.
typename std::conditional< Const, typename Container::const_iterator, typename Container::iterator >::type iterator
The container iterator type (const/non-const)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Walks over a container as if it were circular. The container must have the following members defined:...
typename Container::size_type size_type
The type that can represent the size of Container.
Template-invariant parts for circulators.
ConstCirculator()=default
Default construct.
bool empty() const
True if begin/end iterators are identical.
Like Foam::Circulator, but with const-access iterators.
typename std::conditional< Const, typename Container::const_reference, typename Container::reference >::type reference
The reference type (const/non-const)
bool circulate(const CirculatorBase::direction dir=CirculatorBase::NONE)
Circulate around the list in the given direction.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
reference next() const
Dereference the next iterator.