Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: base/tuple.h

Issue 2797133002: Replace base::get with std::get (Closed)
Patch Set: +styleguide Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/bind_internal.h ('k') | base/tuple_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tuple.h
diff --git a/base/tuple.h b/base/tuple.h
index 34fd789976fcb88daa11860f37a78ff1b51574d9..e13afaf31fc5b3ffa5f229c7351e8c641499dd50 100644
--- a/base/tuple.h
+++ b/base/tuple.h
@@ -51,20 +51,6 @@ template <size_t N, size_t... Ns>
struct MakeIndexSequenceImpl<N, Ns...>
: MakeIndexSequenceImpl<N - 1, N - 1, Ns...> {};
-// 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;
@@ -88,7 +74,7 @@ inline void DispatchToMethodImpl(const ObjT& obj,
Method method,
Tuple&& args,
IndexSequence<Ns...>) {
- (obj->*method)(base::get<Ns>(std::forward<Tuple>(args))...);
+ (obj->*method)(std::get<Ns>(std::forward<Tuple>(args))...);
}
template <typename ObjT, typename Method, typename Tuple>
@@ -105,7 +91,7 @@ template <typename Function, typename Tuple, size_t... Ns>
inline void DispatchToFunctionImpl(Function function,
Tuple&& args,
IndexSequence<Ns...>) {
- (*function)(base::get<Ns>(std::forward<Tuple>(args))...);
+ (*function)(std::get<Ns>(std::forward<Tuple>(args))...);
}
template <typename Function, typename Tuple>
@@ -128,7 +114,7 @@ inline void DispatchToMethodImpl(const ObjT& obj,
OutTuple* out,
IndexSequence<InNs...>,
IndexSequence<OutNs...>) {
- (obj->*method)(base::get<InNs>(std::forward<InTuple>(in))...,
+ (obj->*method)(std::get<InNs>(std::forward<InTuple>(in))...,
&std::get<OutNs>(*out)...);
}
« no previous file with comments | « base/bind_internal.h ('k') | base/tuple_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698