libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
| Public 类型 | Public 成员函数 | Public 属性 | Private 成员函数 | 所有成员列表
variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType > 模板类 参考

Original Authors: Corwin Joy * Michael Gradman cjoy@.nosp@m.hous.nosp@m.ton.r.nosp@m.r.co.nosp@m.m * Micha.nosp@m.el.G.nosp@m.radma.nosp@m.n@ca.nosp@m.minus.nosp@m..com 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. 更多...

#include <variant_filter_iterator.h>

struct  Iter
 The actual iterator object is held as a template parameter here. 更多...
 
struct  IterBase
 Abstract base class for the iterator type. 更多...
 
struct  Pred
 The actual predicate is held as a template parameter here. 更多...
 
struct  PredBase
 Abstract base class for the predicate. 更多...
 

Public 类型

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. 更多...
 

Public 成员函数

template<typename PredType , typename IterType >
 variant_filter_iterator (const IterType &d, const IterType &e, const PredType &p)
 Templated Constructor. 更多...
 
 variant_filter_iterator ()=default
 Default Constructor. 更多...
 
 variant_filter_iterator (const Iterator &rhs)
 Copy Constructor. 更多...
 
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. 更多...
 
virtual ~variant_filter_iterator ()=default
 Destructor. 更多...
 
ReferenceType operator* () const
 unary op*() forwards on to Iter::op*() 更多...
 
PointerType operator-> () const
 op->() 更多...
 
Iteratoroperator++ ()
 op++() forwards on to Iter::op++() 更多...
 
const Iterator operator++ (int)
 postfix op++(), creates a temporary! 更多...
 
bool equal (const variant_filter_iterator &other) const
 Forwards to the equal() function defined for the IterBase pointer. 更多...
 
void swap (Iterator &lhs, Iterator &rhs)
 swap, used to implement op= 更多...
 
Iteratoroperator= (const Iterator &rhs)
 Assignment operator. 更多...
 

Public 属性

std::unique_ptr< IterBasedata
 Ideally this private member data should have protected access. 更多...
 
std::unique_ptr< IterBaseend
 Also have a polymorphic pointer to the end object, this prevents iterating past the end. 更多...
 
std::unique_ptr< PredBasepred
 The predicate object. 更多...
 

Private 成员函数

void satisfy_predicate ()
 Advances the data pointer until it reaches the end or the predicate is satisfied. 更多...
 

详细描述

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
class variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >

Original Authors: Corwin Joy * Michael Gradman cjoy@.nosp@m.hous.nosp@m.ton.r.nosp@m.r.co.nosp@m.m * Micha.nosp@m.el.G.nosp@m.radma.nosp@m.n@ca.nosp@m.minus.nosp@m..com 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.

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.

作者
John W. Peterson
日期
2004

在文件 variant_filter_iterator.h52 行定义.

成员类型定义说明

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::difference_type = std::ptrdiff_t

在文件 variant_filter_iterator.h57 行定义.

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
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.

在文件 variant_filter_iterator.h65 行定义.

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::iterator_category = std::forward_iterator_tag

在文件 variant_filter_iterator.h55 行定义.

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::pointer = PointerType

在文件 variant_filter_iterator.h58 行定义.

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::reference = ReferenceType

在文件 variant_filter_iterator.h59 行定义.

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
using variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::value_type = Type

在文件 variant_filter_iterator.h56 行定义.

构造及析构函数说明

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
template<typename PredType , typename IterType >
variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::variant_filter_iterator ( const IterType &  d,
const IterType &  e,
const PredType &  p 
)
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.

注解
The initialization list uses the default IterBase copy constructor.

在文件 variant_filter_iterator.h325 行定义.

参考 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::satisfy_predicate().

327  :
328  data ( std::make_unique<Iter<IterType>>(d) ),
329  end ( std::make_unique<Iter<IterType>>(e) ),
330  pred ( std::make_unique<Pred<IterType,PredType>>(p) )
331  {
332  this->satisfy_predicate();
333  }
std::unique_ptr< IterBase > end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
void satisfy_predicate()
Advances the data pointer until it reaches the end or the predicate is satisfied. ...
std::unique_ptr< PredBase > pred
The predicate object.
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::variant_filter_iterator ( )
default

Default Constructor.

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::variant_filter_iterator ( const Iterator rhs)
inline

Copy Constructor.

Copy the internal data instead of sharing it.

在文件 variant_filter_iterator.h344 行定义.

344  :
345  data (rhs.data ? rhs.data->clone() : nullptr),
346  end (rhs.end ? rhs.end->clone() : nullptr),
347  pred (rhs.pred ? rhs.pred->clone() : nullptr) {}
std::unique_ptr< IterBase > end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
std::unique_ptr< PredBase > pred
The predicate object.
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
template<class OtherType , class OtherReferenceType , class OtherPointerType , class OtherConstType , class OtherConstReferenceType , class OtherConstPointerType >
variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::variant_filter_iterator ( const variant_filter_iterator< Predicate, OtherType, OtherReferenceType, OtherPointerType, OtherConstType, OtherConstReferenceType, OtherConstPointerType > &  rhs)
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 *

在文件 variant_filter_iterator.h362 行定义.

364  : data (rhs.data ? rhs.data->const_clone() : nullptr),
365  end (rhs.end ? rhs.end->const_clone() : nullptr),
366  pred (rhs.pred ? rhs.pred->const_clone() : nullptr)
367  {
368  }
std::unique_ptr< IterBase > end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
std::unique_ptr< PredBase > pred
The predicate object.
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
virtual variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::~variant_filter_iterator ( )
virtualdefault

Destructor.

成员函数说明

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
bool variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::equal ( const variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType > &  other) const
inline

Forwards to the equal() function defined for the IterBase pointer.

在文件 variant_filter_iterator.h416 行定义.

参考 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::data.

417  {
418  return data->equal(other.data);
419  }
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
ReferenceType variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::operator* ( ) const
inline

unary op*() forwards on to Iter::op*()

在文件 variant_filter_iterator.h378 行定义.

参考 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::data.

379  {
380  return **data;
381  }
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
Iterator& variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::operator++ ( )
inline

op++() forwards on to Iter::op++()

在文件 variant_filter_iterator.h394 行定义.

参考 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::data , 以及 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::satisfy_predicate().

395  {
396  ++*data;
397  this->satisfy_predicate();
398  return *this;
399  }
void satisfy_predicate()
Advances the data pointer until it reaches the end or the predicate is satisfied. ...
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
const Iterator variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::operator++ ( int  )
inline

postfix op++(), creates a temporary!

在文件 variant_filter_iterator.h404 行定义.

参考 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::data , 以及 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::satisfy_predicate().

405  {
406  Iterator oldValue(*this); // standard is to return old value
407  ++*data;
408  this->satisfy_predicate();
409  return oldValue;
410  }
void satisfy_predicate()
Advances the data pointer until it reaches the end or the predicate is satisfied. ...
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType > Iterator
Shortcut name for the fully-qualified typename.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
PointerType variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::operator-> ( ) const
inline

op->()

在文件 variant_filter_iterator.h386 行定义.

387  {
388  return &**this;
389  }
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
Iterator& variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::operator= ( const Iterator rhs)
inline

Assignment operator.

在文件 variant_filter_iterator.h439 行定义.

参考 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::swap().

440  {
441  Iterator temp(rhs);
442  swap(temp, *this);
443  return *this;
444  }
variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType > Iterator
Shortcut name for the fully-qualified typename.
void swap(Iterator &lhs, Iterator &rhs)
swap, used to implement op=
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
void variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::satisfy_predicate ( )
inlineprivate

Advances the data pointer until it reaches the end or the predicate is satisfied.

在文件 variant_filter_iterator.h454 行定义.

参考 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::data , 以及 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::end.

参考自 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::operator++() , 以及 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::variant_filter_iterator().

455  {
456  while ( !data->equal(end) && !(*pred)(data) )
457  ++(*data);
458  }
std::unique_ptr< IterBase > end
Also have a polymorphic pointer to the end object, this prevents iterating past the end...
std::unique_ptr< IterBase > data
Ideally this private member data should have protected access.
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
void variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::swap ( Iterator lhs,
Iterator rhs 
)
inline

类成员变量说明

template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
std::unique_ptr<IterBase> variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::data
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
std::unique_ptr<IterBase> variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::end
template<class Predicate, class Type, class ReferenceType = Type &, class PointerType = Type *, class ConstType = const Type, class ConstReferenceType = const Type &, class ConstPointerType = const Type *>
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.

在文件 variant_filter_iterator.h314 行定义.

参考自 variant_filter_iterator< Predicate, Type, ReferenceType, PointerType, ConstType, ConstReferenceType, ConstPointerType >::swap().


该类的文档由以下文件生成: