ForEachIterator< ITERATOR, SUPER > Class Template Reference Data Structures

#include <foreach.h>

Inheritance diagram for ForEachIterator< ITERATOR, SUPER >:

详细描述

template<typename ITERATOR, typename SUPER = EmptyClass>
class maxon::ForEachIterator< ITERATOR, SUPER >

ForEachIterator is a helper template for the implementation of a foreach iterator (see maxon::Iterable ). You can use it as public base class for your foreach iterator class with the template argument ITERATOR being your class as in

class MyForEachIterator : public ForEachIterator <MyForEachIterator> { public : void operator ++ (); explicit operator Bool () const ; String & operator * () const ; String * operator ->() const ; };

This relieves you from the need to declare a IsForEachIterator type alias, and it adds some functions such as ToString and Contains. However note that these functions are non-const, i.e., they use the current iterator for the iteration so that it will point to another iteration value after function completion.

另请参阅
maxon::Iterable
$ref foreach
Template Parameters
ITERATOR The class which implements the foreach protocol, ForEachIterator should be its base class.
SUPER This is used as base class of ForEachIterator .

Classes

class   Wrapper

Public Types

using  IsForEachIterator = std::true_type

公共成员函数

template<typename... ARGS>
MAXON_ATTRIBUTE_FORCE_INLINE   ForEachIterator (ARGS &&... args)
String   ToString (const FormatStatement *formatStatement=nullptr)
template<typename T >
ITERATOR &  Find (const T &v)
template<typename T >
Int   FindIndex (const T &v)
template<typename T >
MAXON_ATTRIBUTE_FORCE_INLINE Bool   Contains (const T &v)
MAXON_ATTRIBUTE_FORCE_INLINE Wrapper   begin ()

静态公共成员函数

static MAXON_ATTRIBUTE_FORCE_INLINE   PRIVATE_MAXON_RBF_SENTINEL ( Wrapper ) end ()

Member Typedef Documentation

◆  IsForEachIterator

using IsForEachIterator = std::true_type

This marker indicates that this ForEachIterator supports the foreach protocol (see Iterable ).

构造函数 & 析构函数文档编制

◆  ForEachIterator()

MAXON_ATTRIBUTE_FORCE_INLINE ForEachIterator ( ARGS &&...  args )
explicit

成员函数文档编制

◆  Find()

ITERATOR& Find ( const T &  v )

Iterates over this foreach iterator until an iteration value is found which equals v. The function advances this iterator. Example:

MyForEachIterator it = ...; while (it.Find(value)) { ... do something with *it (which equals value) ...; }
参数
[in] v Value for comparison.
返回
This iterator, either pointing to an iteration value which equals v, or to the end.

◆  FindIndex()

Int FindIndex ( const T &  v )

Iterates over this foreach iterator until an iteration value is found which equals v, and returns the number of needed iterations or a negative value if v couldn't be found.

参数
[in] v Value for comparison.
返回
Number of iterations to reach an iteration value which equals v, or a negative value if no such value could be found.
警告
This is a non-const function which uses this iterator for the iteration.

◆  Contains()

MAXON_ATTRIBUTE_FORCE_INLINE Bool Contains ( const T &  v )

Iterates over this foreach iterator until an iteration value is found which equals v and returns true on success, or false if v couldn't be found.

参数
[in] v Value for comparison.
返回
True if v could be found as iteration value of this iterator.
警告
This is a non-const function which uses this iterator for the iteration.

◆  begin()

MAXON_ATTRIBUTE_FORCE_INLINE Wrapper begin ( )

◆  PRIVATE_MAXON_RBF_SENTINEL()

static MAXON_ATTRIBUTE_FORCE_INLINE PRIVATE_MAXON_RBF_SENTINEL ( Wrapper   )
static
maxon::operator++
PORT_DIR & operator++(PORT_DIR &dir)
定义: graph_basics.h:32
maxon::Bool
bool Bool
boolean type, possible values are only false/true, 8 bit
定义: apibase.h:177
maxon::ForEachIterator::ForEachIterator
MAXON_ATTRIBUTE_FORCE_INLINE ForEachIterator(ARGS &&... args)
定义: foreach.h:247
String
定义: c4d_string.h:38
maxon::operator*
Col3< typename MultiplicativePromotion< T, S, STD_IS_REPLACEMENT(scalar, S)>::type, 1 > operator*(S s, const Col3< T, STR > &v)
Multiplies each vector component by a scalar.
定义: col.h:405