Index: base/tuple.h |
diff --git a/base/tuple.h b/base/tuple.h |
index 62344a1233916317b5ff96659fc5370daa5c4260..e82f2e5f06ad8860f722879b44bfef1e150c23f1 100644 |
--- a/base/tuple.h |
+++ b/base/tuple.h |
@@ -104,6 +104,20 @@ struct MakeIndexSequenceImpl<N, Ns...> |
#endif // defined(OS_WIN) && defined(_PREFAST_) |
+// std::get() in <=libstdc++-4.6 returns an lvalue-reference for |
+// rvalue-reference of a tuple, where an rvalue-reference is expected. |
+template <size_t I, typename... Ts> |
+typename std::tuple_element<I, std::tuple<Ts...>>::type&& get( |
+ std::tuple<Ts...>&& t) { |
+ using ElemType = typename std::tuple_element<I, std::tuple<Ts...>>::type; |
+ return std::forward<ElemType>(std::get<I>(t)); |
+} |
+ |
+template <size_t I, typename T> |
+auto get(T& t) -> decltype(std::get<I>(t)) { |
+ return std::get<I>(t); |
+} |
+ |
template <size_t N> |
using MakeIndexSequence = typename MakeIndexSequenceImpl<N>::Type; |