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

Side by Side Diff: base/bind_helpers.h

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/base_unittests.isolate ('k') | base/containers/hash_tables.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 // This defines a set of argument wrappers and related factory methods that 5 // This defines a set of argument wrappers and related factory methods that
6 // can be used specify the refcounting and reference semantics of arguments 6 // can be used specify the refcounting and reference semantics of arguments
7 // that are bound by the Bind() function in base/bind.h. 7 // that are bound by the Bind() function in base/bind.h.
8 // 8 //
9 // It also defines a set of simple functions and utilities that people want 9 // It also defines a set of simple functions and utilities that people want
10 // when using Callback<> and Bind(). 10 // when using Callback<> and Bind().
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 528
529 template <typename... Types1, typename... Types2> 529 template <typename... Types1, typename... Types2>
530 struct ConcatTypeListsImpl<TypeList<Types1...>, TypeList<Types2...>> { 530 struct ConcatTypeListsImpl<TypeList<Types1...>, TypeList<Types2...>> {
531 typedef TypeList<Types1..., Types2...> Type; 531 typedef TypeList<Types1..., Types2...> Type;
532 }; 532 };
533 533
534 // A type-level function that concats two TypeLists. 534 // A type-level function that concats two TypeLists.
535 template <typename List1, typename List2> 535 template <typename List1, typename List2>
536 using ConcatTypeLists = typename ConcatTypeListsImpl<List1, List2>::Type; 536 using ConcatTypeLists = typename ConcatTypeListsImpl<List1, List2>::Type;
537 537
538 template <size_t n, typename List>
539 struct NthTypeImpl;
540
541 template <size_t n, typename T, typename... Types>
542 struct NthTypeImpl<n, TypeList<T, Types...>>
543 : NthTypeImpl<n - 1, TypeList<Types...>> {
544 };
545
546 template <typename T, typename... Types>
547 struct NthTypeImpl<0, TypeList<T, Types...>> {
548 typedef T Type;
549 };
550
551 // A type-level function that extracts |n|th type from a TypeList.
552 template <size_t n, typename List>
553 using NthType = typename NthTypeImpl<n, List>::Type;
554
555 // Used for MakeFunctionType implementation. 538 // Used for MakeFunctionType implementation.
556 template <typename R, typename ArgList> 539 template <typename R, typename ArgList>
557 struct MakeFunctionTypeImpl; 540 struct MakeFunctionTypeImpl;
558 541
559 template <typename R, typename... Args> 542 template <typename R, typename... Args>
560 struct MakeFunctionTypeImpl<R, TypeList<Args...>> { 543 struct MakeFunctionTypeImpl<R, TypeList<Args...>> {
561 typedef R(Type)(Args...); 544 typedef R(Type)(Args...);
562 }; 545 };
563 546
564 // A type-level function that constructs a function type that has |R| as its 547 // A type-level function that constructs a function type that has |R| as its
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 BASE_EXPORT void DoNothing(); 593 BASE_EXPORT void DoNothing();
611 594
612 template<typename T> 595 template<typename T>
613 void DeletePointer(T* obj) { 596 void DeletePointer(T* obj) {
614 delete obj; 597 delete obj;
615 } 598 }
616 599
617 } // namespace base 600 } // namespace base
618 601
619 #endif // BASE_BIND_HELPERS_H_ 602 #endif // BASE_BIND_HELPERS_H_
OLDNEW
« no previous file with comments | « base/base_unittests.isolate ('k') | base/containers/hash_tables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698