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

Side by Side Diff: base/tuple.h

Issue 1896533003: Correct a comment in tuple.h that tripped me up. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A Tuple is a generic templatized container, similar in concept to std::pair 5 // A Tuple is a generic templatized container, similar in concept to std::pair
6 // and std::tuple. The convenient MakeTuple() function takes any number of 6 // and std::tuple. The convenient MakeTuple() function takes any number of
7 // arguments and will construct and return the appropriate Tuple object. The 7 // arguments and will construct and return the appropriate Tuple object. The
8 // functions DispatchToMethod and DispatchToFunction take a function pointer or 8 // functions DispatchToMethod and DispatchToFunction take a function pointer or
9 // instance and method pointer, and unpack a tuple into arguments to the call. 9 // instance and method pointer, and unpack a tuple into arguments to the call.
10 // 10 //
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 template <> struct MakeIndexSequenceImpl<11> { 87 template <> struct MakeIndexSequenceImpl<11> {
88 using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9,10>; 88 using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9,10>;
89 }; 89 };
90 template <> struct MakeIndexSequenceImpl<12> { 90 template <> struct MakeIndexSequenceImpl<12> {
91 using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9,10,11>; 91 using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9,10,11>;
92 }; 92 };
93 template <> struct MakeIndexSequenceImpl<13> { 93 template <> struct MakeIndexSequenceImpl<13> {
94 using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9,10,11,12>; 94 using Type = IndexSequence<0,1,2,3,4,5,6,7,8,9,10,11,12>;
95 }; 95 };
96 96
97 #else // defined(WIN) && defined(_PREFAST_) 97 #else // defined(OS_WIN) && defined(_PREFAST_)
98 98
99 template <size_t... Ns> 99 template <size_t... Ns>
100 struct MakeIndexSequenceImpl<0, Ns...> { 100 struct MakeIndexSequenceImpl<0, Ns...> {
101 using Type = IndexSequence<Ns...>; 101 using Type = IndexSequence<Ns...>;
102 }; 102 };
103 103
104 template <size_t N, size_t... Ns> 104 template <size_t N, size_t... Ns>
105 struct MakeIndexSequenceImpl<N, Ns...> 105 struct MakeIndexSequenceImpl<N, Ns...>
106 : MakeIndexSequenceImpl<N - 1, N - 1, Ns...> {}; 106 : MakeIndexSequenceImpl<N - 1, N - 1, Ns...> {};
107 107
108 #endif // defined(WIN) && defined(_PREFAST_) 108 #endif // defined(OS_WIN) && defined(_PREFAST_)
109 109
110 template <size_t N> 110 template <size_t N>
111 using MakeIndexSequence = typename MakeIndexSequenceImpl<N>::Type; 111 using MakeIndexSequence = typename MakeIndexSequenceImpl<N>::Type;
112 112
113 // Tuple ----------------------------------------------------------------------- 113 // Tuple -----------------------------------------------------------------------
114 // 114 //
115 // This set of classes is useful for bundling 0 or more heterogeneous data types 115 // This set of classes is useful for bundling 0 or more heterogeneous data types
116 // into a single variable. The advantage of this is that it greatly simplifies 116 // into a single variable. The advantage of this is that it greatly simplifies
117 // function objects that need to take an arbitrary number of parameters; see 117 // function objects that need to take an arbitrary number of parameters; see
118 // RunnableMethod and IPC::MessageWithTuple. 118 // RunnableMethod and IPC::MessageWithTuple.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 const Tuple<InTs...>& in, 210 const Tuple<InTs...>& in,
211 Tuple<OutTs...>* out) { 211 Tuple<OutTs...>* out) {
212 DispatchToMethodImpl(obj, method, in, out, 212 DispatchToMethodImpl(obj, method, in, out,
213 MakeIndexSequence<sizeof...(InTs)>(), 213 MakeIndexSequence<sizeof...(InTs)>(),
214 MakeIndexSequence<sizeof...(OutTs)>()); 214 MakeIndexSequence<sizeof...(OutTs)>());
215 } 215 }
216 216
217 } // namespace base 217 } // namespace base
218 218
219 #endif // BASE_TUPLE_H_ 219 #endif // BASE_TUPLE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698