libMesh
|
Original Authors: Corwin Joy * Michael Gradman cjoy@ * hous ton.r r.co mMicha Caminus, Suite 1150, Two Allen Center, 1200 Smith Street, Houston, TX 77002 This class is an extension of variant_bidirectional_iterator to a filter_iterator similar to boost's. el.G radma n@ca minus .comMore...
#include <variant_filter_iterator.h>
Classes | |
struct | Iter |
The actual iterator object is held as a template parameter here. More... | |
struct | IterBase |
Abstract base class for the iterator type. More... | |
struct | Pred |
The actual predicate is held as a template parameter here. More... | |
struct | PredBase |
Abstract base class for the predicate. More... | |
Public Types | |
using | iterator_category = std::forward_iterator_tag |
using | value_type = Type |
using | difference_type = std::ptrdiff_t |
using | pointer = PointerType |
using | reference = ReferenceType |
typedef variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType > | Iterator |
Shortcut name for the fully-qualified typename. More... | |
Public Member Functions | |
template<typename PredType , typename IterType > | |
variant_filter_iterator (const IterType &d, const IterType &e, const PredType &p) | |
Templated Constructor. More... | |
variant_filter_iterator ()=default | |
Default Constructor. More... | |
variant_filter_iterator (const Iterator &rhs) | |
Copy Constructor. More... | |
template<class OtherType , class OtherReferenceType , class OtherPointerType , class OtherConstType , class OtherConstReferenceType , class OtherConstPointerType > | |
variant_filter_iterator (const variant_filter_iterator< Predicate, OtherType, OtherReferenceType, OtherPointerType, OtherConstType, OtherConstReferenceType, OtherConstPointerType > &rhs) | |
Copy construct from another (similar) variant_filter_iterator. More... | |
virtual | ~variant_filter_iterator ()=default |
Destructor. More... | |
ReferenceType | operator* () const |
unary op*() forwards on to Iter::op* () More... | |
PointerType | operator-> () const |
op->() More... | |
Iterator & | operator++ () |
op++() forwards on to Iter::op++ () More... | |
const Iterator | operator++ (int) |
postfix op++(), creates a temporary! More... | |
bool | equal (const variant_filter_iterator &other) const |
Forwards to the equal() function defined for the IterBase pointer. More... | |
void | swap (Iterator &lhs, Iterator &rhs) |
swap, used to implement op= More... | |
Iterator & | operator= (const Iterator &rhs) |
Assignment operator. More... | |
Public Attributes | |
std::unique_ptr< IterBase > | data |
Ideally this private member data should have protected access. More... | |
std::unique_ptr< IterBase > | end |
Also have a polymorphic pointer to the end object, this prevents iterating past the end. More... | |
std::unique_ptr< PredBase > | pred |
The predicate object. More... | |
Private Member Functions | |
void | satisfy_predicate () |
Advances the data pointer until it reaches the end or the predicate is satisfied. More... | |
Original Authors: Corwin Joy * Michael Gradman cjoy@ * hous ton.r r.co mMicha Caminus, Suite 1150, Two Allen Center, 1200 Smith Street, Houston, TX 77002 This class is an extension of variant_bidirectional_iterator to a filter_iterator similar to boost's. el.G radma n@ca minus .com
The filter iterator is modeled after a forward_iterator since to go backward and forward requires the storage of both a "begin" and "end" iterator to avoid stepping off the end or the beginning. To reduce complexity, we only allow traversal in one direction.
Definition at line 52 of file variant_filter_iterator.h.
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::difference_type = std::ptrdiff_t |
Definition at line 57 of file variant_filter_iterator.h.
typedef variant_filter_iterator<Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType> variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::Iterator |
Shortcut name for the fully-qualified typename.
Definition at line 65 of file variant_filter_iterator.h.
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::iterator_category = std::forward_iterator_tag |
Definition at line 55 of file variant_filter_iterator.h.
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::pointer = PointerType |
Definition at line 58 of file variant_filter_iterator.h.
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::reference = ReferenceType |
Definition at line 59 of file variant_filter_iterator.h.
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::value_type = Type |
Definition at line 56 of file variant_filter_iterator.h.
|
inline |
Templated Constructor.
Allows you to construct the iterator and predicate from any types. Also advances the data pointer to the first entry which satisfies the predicate.
Definition at line 325 of file variant_filter_iterator.h.
|
default |
Default Constructor.
|
inline |
Copy Constructor.
Copy the internal data instead of sharing it.
Definition at line 344 of file variant_filter_iterator.h.
|
inline |
Copy construct from another (similar) variant_filter_iterator.
The Predicate is the same, but the Type, ReferenceType and PointerType are different. Example: You are iterating over a std::vector<int *> with std::vector<int *>::iterator Then, you have: Type=int * , ReferenceType=int *& , PointerType=int ** On the other hand, when you iterate using std::vector<int *>::const_iterator you have: Type=int * const, ReferenceType=int * const & , PointerType=int * const *
Definition at line 362 of file variant_filter_iterator.h.
|
virtualdefault |
Destructor.
|
inline |
Forwards to the equal()
function defined for the IterBase pointer.
Definition at line 416 of file variant_filter_iterator.h.
|
inline |
unary op*() forwards on to Iter::op*
()
Definition at line 378 of file variant_filter_iterator.h.
|
inline |
op++() forwards on to Iter::op++
()
Definition at line 394 of file variant_filter_iterator.h.
|
inline |
postfix op++(), creates a temporary!
Definition at line 404 of file variant_filter_iterator.h.
|
inline |
|
inline |
Assignment operator.
Definition at line 439 of file variant_filter_iterator.h.
|
inlineprivate |
Advances the data pointer until it reaches the end or the predicate is satisfied.
Definition at line 454 of file variant_filter_iterator.h.
Referenced by variant_filter_iterator< Elem::Predicate, Elem *>::operator++(), and variant_filter_iterator< Elem::Predicate, Elem *>::variant_filter_iterator().
|
inline |
swap, used to implement op=
Definition at line 424 of file variant_filter_iterator.h.
Referenced by variant_filter_iterator< Elem::Predicate, Elem *>::operator=().
std::unique_ptr<IterBase> variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::data |
Ideally this private member data should have protected access.
However, if we want a const_iterator to be constructable from an non-const one, templated versions of the same class (not related by inheritance) will need to know about these private members. Thus, they have public access.
Polymorphic pointer to the object. Don't confuse with the data pointer located in the Iter!
Definition at line 301 of file variant_filter_iterator.h.
Referenced by variant_filter_iterator< Elem::Predicate, Elem *>::equal(), variant_filter_iterator< Elem::Predicate, Elem *>::operator*(), variant_filter_iterator< Elem::Predicate, Elem *>::operator++(), variant_filter_iterator< Elem::Predicate, Elem *>::satisfy_predicate(), and variant_filter_iterator< Elem::Predicate, Elem *>::swap().
std::unique_ptr<IterBase> variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::end |
Also have a polymorphic pointer to the end object, this prevents iterating past the end.
Definition at line 307 of file variant_filter_iterator.h.
Referenced by variant_filter_iterator< Elem::Predicate, Elem *>::satisfy_predicate(), and variant_filter_iterator< Elem::Predicate, Elem *>::swap().
std::unique_ptr<PredBase> variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::pred |
The predicate object.
Must have op() capable of operating on IterBase * pointers. Therefore it has to follow the same paradigm as IterBase
.
Definition at line 314 of file variant_filter_iterator.h.
Referenced by variant_filter_iterator< Elem::Predicate, Elem *>::swap().