Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
IterSnapshot< VAL > Class Template Reference

#include "lib/iter-adapter-stl.hpp"

Description

template<typename VAL>
class lib::iter_stl::IterSnapshot< VAL >

materialised iterator contents.

At construction, the given source iterator is immediately discharged into an internal buffer (vector). This captured value sequence can then be retrieved once as Lumiera Forward Iterator

Definition at line 414 of file iter-adapter-stl.hpp.

Public Types

using pointer = VAL *
 
using reference = VAL &
 
using value_type = VAL
 

Public Member Functions

 IterSnapshot ()
 create empty snapshot
 
template<class IT >
 IterSnapshot (IT &&src)
 take snapshot by discharging the given Lumiera Forward iterator
 
template<class IT >
 IterSnapshot (IT const &src)
 build snapshot from a copy of the Lumiera Iterator
 
template<class IT >
 IterSnapshot (IT &&pos, IT const &end)
 take snapshot by consuming a STL iterator
 
template<class IT >
 IterSnapshot (IT const &begin, IT const &end)
 take snapshot from STL iterator
 
 IterSnapshot (IterSnapshot &&)=default
 
 IterSnapshot (IterSnapshot const &)=default
 
IterSnapshotoperator= (IterSnapshot const &)=default
 
IterSnapshotoperator= (IterSnapshot &&)=default
 
 operator bool () const
 
size_t size () const
 
reference operator* () const
 
pointer operator-> () const
 
IterSnapshotoperator++ ()
 
bool isValid () const
 
bool empty () const
 

Friends

bool operator== (IterSnapshot const &s1, IterSnapshot const &s2)
 equality is based first on the valid state (to support pos != end) and then on the actual position and contents of the snapshots
 
bool operator!= (IterSnapshot const &snap1, IterSnapshot const &snap2)
 

Private Types

using Sequence = std::vector< VAL >
 

Private Member Functions

void _maybe_throw () const
 

Private Attributes

Sequence buffer_
 
size_t pos_ = 0
 

Constructor & Destructor Documentation

◆ IterSnapshot() [1/7]

template<typename VAL >
IterSnapshot ( )
inline

create empty snapshot

Definition at line 425 of file iter-adapter-stl.hpp.

◆ IterSnapshot() [2/7]

template<typename VAL >
template<class IT >
IterSnapshot ( IT &&  src)
inline

take snapshot by discharging the given Lumiera Forward iterator

Warning
depending on the implementation backing the source iterator, this might or might not yield side-effects.

Definition at line 432 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::buffer_.

◆ IterSnapshot() [3/7]

template<typename VAL >
template<class IT >
IterSnapshot ( IT const &  src)
inline

build snapshot from a copy of the Lumiera Iterator

Warning
depending on the implementation backing the source iterator, this might or might not yield side-effects.

Definition at line 443 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::buffer_.

◆ IterSnapshot() [4/7]

template<typename VAL >
template<class IT >
IterSnapshot ( IT &&  pos,
IT const &  end 
)
inline

take snapshot by consuming a STL iterator

Definition at line 451 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::buffer_.

◆ IterSnapshot() [5/7]

template<typename VAL >
template<class IT >
IterSnapshot ( IT const &  begin,
IT const &  end 
)
inline

take snapshot from STL iterator

Definition at line 459 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::buffer_.

◆ IterSnapshot() [6/7]

template<typename VAL >
IterSnapshot ( IterSnapshot< VAL > &&  )
default

◆ IterSnapshot() [7/7]

template<typename VAL >
IterSnapshot ( IterSnapshot< VAL > const &  )
default

Member Typedef Documentation

◆ Sequence

template<typename VAL >
using Sequence = std::vector<VAL>
private

Definition at line 416 of file iter-adapter-stl.hpp.

◆ pointer

template<typename VAL >
using pointer = VAL*

Definition at line 486 of file iter-adapter-stl.hpp.

◆ reference

template<typename VAL >
using reference = VAL&

Definition at line 487 of file iter-adapter-stl.hpp.

◆ value_type

template<typename VAL >
using value_type = VAL

Definition at line 488 of file iter-adapter-stl.hpp.

Member Function Documentation

◆ operator=() [1/2]

template<typename VAL >
IterSnapshot & operator= ( IterSnapshot< VAL > const &  )
default

◆ operator=() [2/2]

template<typename VAL >
IterSnapshot & operator= ( IterSnapshot< VAL > &&  )
default

◆ operator bool()

template<typename VAL >
operator bool ( ) const
inlineexplicit

Definition at line 471 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::isValid().

+ Here is the call graph for this function:

◆ size()

template<typename VAL >
size_t size ( ) const
inline

Definition at line 477 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::buffer_.

◆ operator*()

template<typename VAL >
reference operator* ( ) const
inline

Definition at line 491 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::_maybe_throw(), IterSnapshot< VAL >::buffer_, and IterSnapshot< VAL >::pos_.

+ Here is the call graph for this function:

◆ operator->()

template<typename VAL >
pointer operator-> ( ) const
inline

Definition at line 498 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::_maybe_throw(), IterSnapshot< VAL >::buffer_, and IterSnapshot< VAL >::pos_.

+ Here is the call graph for this function:

◆ operator++()

template<typename VAL >
IterSnapshot & operator++ ( )
inline

Definition at line 505 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::_maybe_throw(), and IterSnapshot< VAL >::pos_.

+ Here is the call graph for this function:

◆ isValid()

template<typename VAL >
bool isValid ( ) const
inline

Definition at line 513 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::buffer_, and IterSnapshot< VAL >::pos_.

Referenced by IterSnapshot< VAL >::_maybe_throw(), IterSnapshot< VAL >::empty(), and IterSnapshot< VAL >::operator bool().

+ Here is the caller graph for this function:

◆ empty()

template<typename VAL >
bool empty ( ) const
inline

Definition at line 519 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::isValid().

+ Here is the call graph for this function:

◆ _maybe_throw()

template<typename VAL >
void _maybe_throw ( ) const
inlineprivate

Definition at line 548 of file iter-adapter-stl.hpp.

References IterSnapshot< VAL >::isValid().

Referenced by IterSnapshot< VAL >::operator*(), IterSnapshot< VAL >::operator++(), and IterSnapshot< VAL >::operator->().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ buffer_

◆ pos_

template<typename VAL >
size_t pos_ = 0
private

Friends And Related Symbol Documentation

◆ operator==

template<typename VAL >
bool operator== ( IterSnapshot< VAL > const &  s1,
IterSnapshot< VAL > const &  s2 
)
friend

equality is based first on the valid state (to support pos != end) and then on the actual position and contents of the snapshots

Definition at line 530 of file iter-adapter-stl.hpp.

◆ operator!=

template<typename VAL >
bool operator!= ( IterSnapshot< VAL > const &  snap1,
IterSnapshot< VAL > const &  snap2 
)
friend

Definition at line 540 of file iter-adapter-stl.hpp.

+ Collaboration diagram for IterSnapshot< VAL >:

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