LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 34 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 38 of file operations.h.

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

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