STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

select_both Struct Template Reference

This functional selects both the first and second members of an instance (obviously this is usually the std::pair type), and applies the respective parameterising functionals to them. More...

#include <stlsoft_functionals.h>

List of all members.

Public Methods

 select_both ()
 Default constructor.

 select_both (F1 f1, F2 f2)
 Constructs from the given function objects, which it will then apply via operator()().

template<typename T> void operator() (T &t)
 Function call operator, which applies the parameterising function objects to the first and second parts of the pair t.


Detailed Description

template<typename F1, typename F2>
struct stlsoft::select_both< F1, F2 >

This functional selects both the first and second members of an instance (obviously this is usually the std::pair type), and applies the respective parameterising functionals to them.

For example, if you have a std::map and wish to write out the keys with the dump_key functional and the values with the dump_value functional, you could achieve this with the following:

  std::for_each(m.begin(), m.end(), stlsoft::select_both<dump_key, dump_value>());

Parameters:
F1  The functional to apply to the first part of the elements
F2  The functional to apply to the second part of the elements


Constructor & Destructor Documentation

select_both   [inline]
 

Default constructor.

select_both F1    f1,
F2    f2
[inline, explicit]
 

Constructs from the given function objects, which it will then apply via operator()().


Member Function Documentation

void operator() T &    t [inline]
 

Function call operator, which applies the parameterising function objects to the first and second parts of the pair t.

Parameters:
t  An instance of a pair like type, to whose first and second members will be applied the functions F1 and F2


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

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004