| Index: base/stl_util.h
|
| diff --git a/base/stl_util.h b/base/stl_util.h
|
| index af77150f6b3a83d6d8081b7182492c0a7c021ac4..6338c7ef7844867e193190e293a61a113e73b6b7 100644
|
| --- a/base/stl_util.h
|
| +++ b/base/stl_util.h
|
| @@ -11,6 +11,19 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| +// Return the address of an object as a unary functor.
|
| +// Can be used with std::transform to make a container of pointers from a
|
| +// container of objects.
|
| +// NOTE: Does not work around the possibility that operator & is overloaded.
|
| +template<typename T>
|
| +T* address_of(T& v) {
|
| + return &v;
|
| +}
|
| +template<typename T>
|
| +const T* const_address_of(const T& v) {
|
| + return &v;
|
| +}
|
| +
|
| // Clear internal memory of an STL object.
|
| // STL clear()/reserve(0) does not always free internal memory allocated
|
| // This function uses swap/destructor to ensure the internal memory is freed.
|
|
|