• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_TEST_TEST_FUTURE_INTERNAL_H_
6 #define BASE_TEST_TEST_FUTURE_INTERNAL_H_
7 
8 #include <tuple>
9 #include <type_traits>
10 
11 namespace base::test::internal {
12 
13 // Helper to only implement a method if the future holds one or more values
14 template <typename Tuple>
15 using EnableIfOneOrMoreValues =
16     std::enable_if_t<(std::tuple_size<Tuple>::value > 0), bool>;
17 
18 // Helper to only implement a method if the future holds a single value
19 template <typename Tuple>
20 using EnableIfSingleValue =
21     std::enable_if_t<(std::tuple_size<Tuple>::value == 1), bool>;
22 
23 // Helper to only implement a method if the future holds multiple values
24 template <typename Tuple>
25 using EnableIfMultiValue =
26     std::enable_if_t<(std::tuple_size<Tuple>::value > 1), bool>;
27 
28 }  // namespace base::test::internal
29 
30 #endif  // BASE_TEST_TEST_FUTURE_INTERNAL_H_
31