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



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to