• 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 concept IsNonEmptyTuple = std::tuple_size<Tuple>::value > 0;
16 
17 // Helper to only implement a method if the future holds a single value.
18 template <typename Tuple>
19 concept IsSingleValuedTuple = std::tuple_size<Tuple>::value == 1;
20 
21 // Helper to only implement a method if the future holds multiple values.
22 template <typename Tuple>
23 concept IsMultiValuedTuple = std::tuple_size<Tuple>::value > 1;
24 
25 }  // namespace base::test::internal
26 
27 #endif  // BASE_TEST_TEST_FUTURE_INTERNAL_H_
28