Instigate Open Source Documentation

instigate::stl::unary_function Namespace Reference

instigate::stl::unary_function More...


Classes

struct  tag
 Unary Function Concept tag. More...
struct  interface
 Interface for the concept instigate::stl::unary_function. More...
struct  interface< R(*)(A)>
 Making plain C function with 1 arguments a model of concept instigate::stl::unary_function. More...
struct  interface< R(A::*)()>
 Making a void method of class a model of the concept instigate::stl::unary_function. More...
struct  interface< R(A::*)() const >
 Making a const void method of class a model of the concept instigate::stl::unary_function. More...
struct  requirements
 Requirements of the Unary Function. More...


Detailed Description

instigate::stl::unary_function

Unary Function Concept.

unary_function is a correspondence between an argument value and a result value. I.e. for each argument value it should be possible to invoke the function and obtain the corresponding result value. 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 Unary Function because we require information about argument type and result type. Thus, all unary functions in Instigate STL are adaptable, including plain C functions.

Note:
It is under user's responsibility, to define associated types (i.e. argument_type and result_type) in such way, that temporary objects will not be created by the compiler upon passing argument and returning value, e.g. argument can be passed by reference or const reference.
This is a "non-intrusive" interface for the unary_function, which does not impose any syntactical constraints on the Model. Any type that conceptually can be treated as an unary function 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.


© Instigate CJSC, Open Source