Public Member Functions | List of all members
util::AddressTaker Struct Reference

Functor returning the address in memory of the operand. More...

#include <operations.h>

Public Member Functions

template<typename T >
auto operator() (T &ref) const
 Returns the address of the argument. More...
 

Detailed Description

Functor returning the address in memory of the operand.

See also
util::takeAddress()

Example:

std::vector<int*> ptrs(data.size());
std::transform
(data.begin(), data.end(), ptrs.begin(), util::AddressTaker{});

will fill the vector ptrs with pointers to the elements of data.

Note
The address is extracted via std::addressof() and it bypasses the operator&() of the operand.

Definition at line 36 of file operations.h.

Member Function Documentation

template<typename T >
auto util::AddressTaker::operator() ( T &  ref) const
inline

Returns the address of the argument.

Definition at line 40 of file operations.h.

40 { return std::addressof(ref); }

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