Pred< IterType, PredType > Struct Template Reference

#include <variant_filter_iterator.h>

Inheritance diagram for Pred< IterType, PredType >:

Public Member Functions

 Pred (const PredType &v)
 
virtual ~Pred ()
 
virtual PredBase * clone () const
 
virtual PredBase::const_PredBase * const_clone () const
 
virtual bool operator() (const IterBase *in) const
 

Public Attributes

PredType pred_data
 

Detailed Description

template<typename IterType, typename PredType>
struct Pred< IterType, PredType >

The actual predicate is held as a template parameter here. There are two template arguments here, one for the actual type of the predicate and one for the iterator type.

Definition at line 228 of file variant_filter_iterator.h.

Constructor & Destructor Documentation

template<typename IterType, typename PredType>
Pred< IterType, PredType >::Pred ( const PredType &  v)
inline

Constructor

Definition at line 233 of file variant_filter_iterator.h.

233  :
234  pred_data (v) {}
template<typename IterType, typename PredType>
virtual Pred< IterType, PredType >::~Pred ( )
inlinevirtual

Destructor

Definition at line 239 of file variant_filter_iterator.h.

239 {}

Member Function Documentation

template<typename IterType, typename PredType>
virtual PredBase* Pred< IterType, PredType >::clone ( ) const
inlinevirtual

Returns a copy of this object as a pointer to the base class.

Definition at line 244 of file variant_filter_iterator.h.

245  {
246 #ifdef __SUNPRO_CC
247  variant_filter_iterator::Pred<IterType,PredType> *copy =
248  new variant_filter_iterator::Pred<IterType,PredType>(pred_data);
249 #else
252 #endif
253 
254  return copy;
255  }
template<typename IterType, typename PredType>
virtual PredBase::const_PredBase* Pred< IterType, PredType >::const_clone ( ) const
inlinevirtual

The redefinition of the const_clone function for the Pred class. Notice the strange typename syntax required. Will it compile everywhere?

Important typedef for const_iterators. Notice the weird syntax! Does it compile everywhere?

Definition at line 262 of file variant_filter_iterator.h.

263  {
267  // typedef typename variant_filter_iterator<Predicate, Type, const Type&, const Type*>::template Pred<IterType, PredType> const_Pred;
268  typedef typename variant_filter_iterator<Predicate, Type const, Type const &, Type const *>::template Pred<IterType, PredType> const_Pred;
269 
270 
271  typename PredBase::const_PredBase* copy =
272  new const_Pred(pred_data);
273 
274  return copy;
275  }
template<typename IterType, typename PredType>
virtual bool Pred< IterType, PredType >::operator() ( const IterBase *  in) const
inlinevirtual

Re-implementation of op()

Definition at line 283 of file variant_filter_iterator.h.

References libMesh::libmesh_assert().

284  {
285  libmesh_assert(in);
286 
287  // Attempt downcast
288 #if defined(__SUNPRO_CC) || (defined(__GNUC__) && (__GNUC__ < 3) && !defined(__INTEL_COMPILER))
289  const variant_filter_iterator::Iter<IterType>* p =
290  libMesh::libmesh_cast_ptr<const variant_filter_iterator::Iter<IterType>* >(in);
291 #else
292  const Iter<IterType>* p =
293  libMesh::libmesh_cast_ptr<const Iter<IterType>* >(in);
294 #endif
295 
296  // Return result of op() for the user's predicate.
297  return pred_data(p->iter_data);
298  }

Member Data Documentation

template<typename IterType, typename PredType>
PredType Pred< IterType, PredType >::pred_data

This is the predicate passed in by the user.

Definition at line 303 of file variant_filter_iterator.h.


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

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:58 UTC

Hosted By:
SourceForge.net Logo