$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2003-06-04 18:23:12
Hi,
Several times I've found myself in need of boost::addressof as a function
object/functor.
I believe this trivial little wrapper could be a convenient addition to the
utility lib.
struct addressof_t { // better name??
template <typename T>
T* operator()(T& v) const {
return boost::addressof(v);
}
};
//// Use case:
std::vector<foo> values;
// ...
std::vector<foo*> valueptrs;
// ...
std::transform(
values.begin(), values.end(),
valueptrs.begin(),
addressof_t() // <-- cannot use boost::addressof<foo> ...
);
comments?
// Fredrik Blomqvist