Embedded Template Library 1.0
Loading...
Searching...
No Matches
etl::select2nd< TPair > Struct Template Reference

Functor to select pair::second. More...

#include <utility.h>

Public Types

typedef TPair::second_type type
 type of member pair::second.
 

Public Member Functions

typeoperator() (TPair &p) const
 Function call. The return value is p.second.
 
const typeoperator() (const TPair &p) const
 Function call. The return value is p.second.
 

Detailed Description

template<typename TPair>
struct etl::select2nd< TPair >

Functor to select pair::second.

select2nd is a functor object that takes a single argument, a pair, and returns the pair::second element.

Example

using Map = std::map<int, double>;
using Vector = std::vector<double>;
const Map map = {{1, 0.3},
{47, 0.8},
{33, 0.1}};
Vector result{};
// Extract the map values into a vector
std::transform(map.begin(), map.end(), std::back_inserter(result), etl::select2nd<Map::value_type>());
A templated map implementation that uses a fixed size buffer.
Definition map.h:2667
pair holds two objects of arbitrary type
Definition utility.h:164
Template Parameters
TPairThe function object's argument type.
See also
select1st

Member Function Documentation

◆ operator()() [1/2]

template<typename TPair >
const type & etl::select2nd< TPair >::operator() ( const TPair p) const
inline

Function call. The return value is p.second.

Returns
a reference to member second of the pair p.

◆ operator()() [2/2]

template<typename TPair >
type & etl::select2nd< TPair >::operator() ( TPair p) const
inline

Function call. The return value is p.second.

Returns
a reference to member second of the pair p.

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