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

Side by Side Diff: base/tuple.h

Issue 1137323003: Cleanup: Fix base header include guards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « base/trace_event/trace_event_etw_export_win.h ('k') | base/win/resource_util.h » ('j') | 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 //
11 // Tuple elements are copied by value, and stored in the tuple. See the unit 11 // Tuple elements are copied by value, and stored in the tuple. See the unit
12 // tests for more details of how/when the values are copied. 12 // tests for more details of how/when the values are copied.
13 // 13 //
14 // Example usage: 14 // Example usage:
15 // // These two methods of creating a Tuple are identical. 15 // // These two methods of creating a Tuple are identical.
16 // Tuple<int, const char*> tuple_a(1, "wee"); 16 // Tuple<int, const char*> tuple_a(1, "wee");
17 // Tuple<int, const char*> tuple_b = MakeTuple(1, "wee"); 17 // Tuple<int, const char*> tuple_b = MakeTuple(1, "wee");
18 // 18 //
19 // void SomeFunc(int a, const char* b) { } 19 // void SomeFunc(int a, const char* b) { }
20 // DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee") 20 // DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee")
21 // DispatchToFunction( 21 // DispatchToFunction(
22 // &SomeFunc, MakeTuple(10, "foo")); // SomeFunc(10, "foo") 22 // &SomeFunc, MakeTuple(10, "foo")); // SomeFunc(10, "foo")
23 // 23 //
24 // struct { void SomeMeth(int a, int b, int c) { } } foo; 24 // struct { void SomeMeth(int a, int b, int c) { } } foo;
25 // DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3)); 25 // DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3));
26 // // foo->SomeMeth(1, 2, 3); 26 // // foo->SomeMeth(1, 2, 3);
27 27
28 #ifndef BASE_TUPLE_H__ 28 #ifndef BASE_TUPLE_H_
29 #define BASE_TUPLE_H__ 29 #define BASE_TUPLE_H_
30 30
31 #include "base/bind_helpers.h" 31 #include "base/bind_helpers.h"
32 32
33 // Index sequences 33 // Index sequences
34 // 34 //
35 // Minimal clone of the similarly-named C++14 functionality. 35 // Minimal clone of the similarly-named C++14 functionality.
36 36
37 template <size_t...> 37 template <size_t...>
38 struct IndexSequence {}; 38 struct IndexSequence {};
39 39
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 template <typename ObjT, typename Method, typename... InTs, typename... OutTs> 322 template <typename ObjT, typename Method, typename... InTs, typename... OutTs>
323 inline void DispatchToMethod(ObjT* obj, 323 inline void DispatchToMethod(ObjT* obj,
324 Method method, 324 Method method,
325 const Tuple<InTs...>& in, 325 const Tuple<InTs...>& in,
326 Tuple<OutTs...>* out) { 326 Tuple<OutTs...>* out) {
327 DispatchToMethodImpl(obj, method, in, out, 327 DispatchToMethodImpl(obj, method, in, out,
328 MakeIndexSequence<sizeof...(InTs)>(), 328 MakeIndexSequence<sizeof...(InTs)>(),
329 MakeIndexSequence<sizeof...(OutTs)>()); 329 MakeIndexSequence<sizeof...(OutTs)>());
330 } 330 }
331 331
332 #endif // BASE_TUPLE_H__ 332 #endif // BASE_TUPLE_H_
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_etw_export_win.h ('k') | base/win/resource_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698