Instigate Open Source Documentation

instigate::stl::generator::interface< G > Struct Template Reference

Interface of the instigate::stl::generator "Generator Concept" More...

#include <_generator.hpp>

Inheritance diagram for instigate::stl::generator::interface< G >:

instigate::generic::assignable::interface< G >

List of all members.

Public Types

typedef G::result_type result_type
 type of the value returned by the function

Static Public Member Functions

static result_type invoke (const G &f)
 Invoke the function.

Detailed Description

template<typename G>
struct instigate::stl::generator::interface< G >

Interface of the instigate::stl::generator "Generator Concept"

A generator is a kind of object: an object that is called as if it were an ordinary C++ function. A generator is called with no arguments.

Ideally, invocation should have constant time complexity. Although the algorithms that use this concept are applicable even if the functions have higher complexity, but using them with such functions invalidates the complexity guarantee of the algorithm itself.

This corresponds to SGI STL's concept Adaptable generator because we require information about result type. Thus, all generators in Instigate STL are adaptable, including plain C functions.

It is under user's responsibility, to define associated types (i.e. result_type) in such way, that temporary objects will not be created by the compiler upon passing argument and returning value.
This is a "non-intrusive" interface of the generator, which does not impose any syntactical constraints on the Model. Any type that conceptually can be treated as an generator can become a model of this concept, if this interface is provided for it by specializing this template structure with that type and providing definitions for associated types and basic operations.

Member Function Documentation

template<typename G>
static result_type instigate::stl::generator::interface< G >::invoke ( const G &  f  )  [inline, static]

Invoke the function.

f - function to be invoked
the result of invocation of f

Referenced by instigate::stl::invoke().

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

© Instigate CJSC, Open Source