ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
has_duplicates.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file has_duplicates.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 namespace Acts {
11 
12 namespace detail {
13 
14 namespace {
15 template <typename... Args>
17 
18 template <>
19 struct has_duplicates<> {
20  static constexpr bool value = false;
21 };
22 
23 template <typename last>
24 struct has_duplicates<last> {
25  static constexpr bool value = false;
26 };
27 
28 template <typename first, typename second, typename... others>
29 struct has_duplicates<first, second, others...> {
30  private:
31  static constexpr bool _first = has_duplicates<first, others...>::value;
32  static constexpr bool _second = has_duplicates<second, others...>::value;
33 
34  public:
35  static constexpr bool value = _first or _second;
36 };
37 
38 template <typename first, typename... others>
39 struct has_duplicates<first, first, others...> {
40  static constexpr bool value = true;
41 };
42 } // namespace
43 
44 template <typename... Args>
45 constexpr bool has_duplicates_v = has_duplicates<Args...>::value;
46 } // namespace detail
47 
48 } // namespace Acts