Loading...
Searching...
No Matches
etl::select1st< TPair > Struct Template Reference

Functor to select pair::first. More...

`#include <utility.h>`

## Public Types

typedef TPair::first_type | type
| type of member pair::first.

## Public Member Functions

type & | operator() (TPair &p) const
| Function call that return `p.first`.
const type & | operator() (const TPair &p) const
| Function call that return `p.first`.

## Detailed Description

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

Functor to select pair::first.

select1st is a functor object that takes a single argument, a pair, and returns the pair::first element. Example

using Map = std::map<int, double>;
using Vector = std::vector<int>;
const Map map = {{1, 0.3}, {47, 0.8}, {33, 0.1}};
Vector result{};
// Extract the map keys into a vector
std::transform(map.begin(), map.end(), std::back_inserter(result), etl::select1st<Map::value_type>());

Template Parameters

  TPair | The function object's argument type.

See also
  select2nd

## Member Function Documentation

## operator()() [1/2]

template<typename TPair>

const type & etl::select1st< TPair >::operator() | ( | const TPair & | p | ) | const

inline

Function call that return `p.first`.

Returns
  a reference to member pair::first of the `pair` p

## operator()() [2/2]

template<typename TPair>

type & etl::select1st< TPair >::operator() | ( | TPair & | p | ) | const

inline

Function call that return `p.first`.

Returns
  a reference to member pair::first of the `pair` p

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

- include/etl/utility.h