Embedded Template Library 1.0
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. More...
 
const typeoperator() (const TPair &p) const
 Function call. The return value is p.second. More...
 

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
ETL_NODISCARD ETL_CONSTEXPR14 etl::back_insert_iterator< TContainer > back_inserter(TContainer &container)
Definition: iterator.h:682
Functor to select pair::second.
Definition: utility.h:426
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: