Go to Overview over all GrAL packages.
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

unary_fct_ref Class Template Reference
[Accessors, Function Objects and Iterator Adaptors]

Adapter for enforcing reference semantic in case of "heavy" function objects. More...

#include <function-adapter.h>

Collaboration diagram for unary_fct_ref:

Collaboration graph
[legend]
List of all members.

Public Types

typedef F::argument_type argument_type
typedef F::result_type result_type

Public Methods

 unary_fct_ref ()
 unary_fct_ref (const F &ff)
result_type operator() (const argument_type &x) const

Detailed Description

template<class F>
class unary_fct_ref< F >

Adapter for enforcing reference semantic in case of "heavy" function objects.

Model of Adaptable Unary Function.

Function objects are often passed by value in STL algorithms, e.g. in unary_compose<F1,F2>. This is not wanted in the case of 'heavy' function objects, thus, a references wrapper is passed by value.

Example:

   bijective_mapping<int, int> f;
   // fill f ...
   int v[100]; iota(v,v+100,0); // v = {0,1, ..., 99}
   int w[100];
   copy_filter(v,v+100, w, make_unary_fct_ref(f));
(Cf. SGI iota.)

Todo:
The problem of passing function objects by reference vs. by value should be handled in some more general way, because it places the burden on the algorithm user which usually does not know whether copying is intended or not (at least not at the point of calling the algorithm).

See also:
make_unary_fct_ref() , Accessors, Function Objects and Iterator Adaptors module

Definition at line 45 of file function-adapter.h.


Member Typedef Documentation

template<class F>
typedef F::argument_type unary_fct_ref::argument_type
 

Definition at line 49 of file function-adapter.h.

Referenced by operator().

template<class F>
typedef F::result_type unary_fct_ref::result_type
 

Definition at line 50 of file function-adapter.h.

Referenced by operator().


Constructor & Destructor Documentation

template<class F>
unary_fct_ref< F >::unary_fct_ref   [inline]
 

Definition at line 52 of file function-adapter.h.

template<class F>
unary_fct_ref< F >::unary_fct_ref const F &    ff [inline]
 

Definition at line 53 of file function-adapter.h.


Member Function Documentation

template<class F>
result_type unary_fct_ref< F >::operator() const argument_type   x const [inline]
 

Definition at line 55 of file function-adapter.h.

References argument_type, and result_type.


The documentation for this class was generated from the following file:
Copyright (c) Guntram Berti 1997-2002. See the GrAL Homepage for up-to-date information.

Generated at Tue Feb 26 15:57:17 2002 for Sequence by doxygen 1.2.11-20011104 written by Dimitri van Heesch, © 1997-2000