Chromium Code Reviews| Index: webrtc/base/bind.h.pump |
| diff --git a/webrtc/base/bind.h.pump b/webrtc/base/bind.h.pump |
| index e1cea61fc2afe85c432daf3f1639c06bbacecebe..874464208efeedd00cd2cffee5c0f2617b03ac49 100644 |
| --- a/webrtc/base/bind.h.pump |
| +++ b/webrtc/base/bind.h.pump |
| @@ -60,6 +60,15 @@ |
| #ifndef WEBRTC_BASE_BIND_H_ |
| #define WEBRTC_BASE_BIND_H_ |
| +#include <ciso646> // Small include to detect c++ std lib. |
| +#if defined(_LIBCPP_VERSION) || defined(_MSC_VER) |
| +#include <type_traits> |
|
magjed_webrtc
2015/10/22 23:54:31
I'm surprised this compiles on all webrtc bots, bu
noahric
2015/10/23 00:34:27
Ah, yeah, good point. And I realized I was being d
magjed_webrtc
2015/10/23 05:17:01
I don't remember why I stripped const-ness, but I
noahric
2015/10/23 06:02:16
Gotcha. Seems to be fine now that they are const a
|
| +#define STD_REMOVE_REFERENCE std::remove_reference |
| +#else |
| +#include <tr1/type_traits> |
| +#define STD_REMOVE_REFERENCE std::tr1::remove_reference |
| +#endif |
| + |
| #include "webrtc/base/scoped_ref_ptr.h" |
| #define NONAME |
| @@ -124,21 +133,24 @@ struct PointerType { |
| T*>::type type; |
| }; |
| -// RemoveScopedPtrRef will capture scoped_refptr by-value instead of |
| -// by-reference. |
| -template <class T> struct RemoveScopedPtrRef { typedef T type; }; |
| +// RemoveAllRef will capture scoped_refptr by-value instead of |
| +// by-reference. It will additionally capture non-refptr T types by value. |
| +template <class T> |
| +struct RemoveAllRef { |
| + typedef typename STD_REMOVE_REFERENCE<T>::type type; |
| +}; |
| template <class T> |
| -struct RemoveScopedPtrRef<const scoped_refptr<T>&> { |
| +struct RemoveAllRef<const scoped_refptr<T>&> { |
| typedef scoped_refptr<T> type; |
| }; |
| template <class T> |
| -struct RemoveScopedPtrRef<scoped_refptr<T>&> { |
| +struct RemoveAllRef<scoped_refptr<T>&> { |
| typedef scoped_refptr<T> type; |
| }; |
| } // namespace detail |
| -$var n = 6 |
| +$var n = 9 |
| $range i 0..n |
| $for i [[ |
| $range j 1..i |
| @@ -157,7 +169,7 @@ class MethodFunctor$i { |
| MethodT method_; |
| typename detail::PointerType<ObjectT>::type object_;$for j [[ |
| - typename detail::RemoveScopedPtrRef<P$j>::type p$(j)_;]] |
| + typename detail::RemoveAllRef<P$j>::type p$(j)_;]] |
| }; |
| @@ -174,7 +186,7 @@ Functor$i(const FunctorT& functor$for j [[, P$j p$j]]) |
| private: |
| FunctorT functor_;$for j [[ |
| - typename detail::RemoveScopedPtrRef<P$j>::type p$(j)_;]] |
| + typename detail::RemoveAllRef<P$j>::type p$(j)_;]] |
| }; |