Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Acts/Utilities/detail/MPL/are_within.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 namespace Acts::detail {
0011 /**
0012  * @brief check whether integral values are within a given range
0013  *
0014  * @tparam T integral type of values whose range should be checked
0015  * @tparam MIN lower accepted bound of values (inclusive)
0016  * @tparam MAX upper accepted bound of values (exclusive)
0017  * @tparam values template parameter pack containing the list of values
0018  *
0019  * @test Unit tests are implemented \link
0020  * Acts::Test::BOOST_AUTO_TEST_CASE(are_within_helper_tests) here\endlink.
0021  *
0022  * @return `are_within<T,MIN,MAX,values...>::value` is @c true if all given
0023  * values are within the
0024  *          interval [MIN,MAX), otherwise @c false
0025  */
0026 template <typename T, T MIN, T MAX, T... values>
0027 struct are_within;
0028 
0029 /// @cond
0030 // check last parameter
0031 template <typename T, T MIN, T MAX, T a>
0032 struct are_within<T, MIN, MAX, a> {
0033   enum { value = (a >= MIN && a < MAX) };
0034 };
0035 
0036 // recursive check
0037 template <typename T, T MIN, T MAX, T a, T... others>
0038 struct are_within<T, MIN, MAX, a, others...> {
0039   enum {
0040     value =
0041         ((a >= MIN) && (a < MAX) && are_within<T, MIN, MAX, others...>::value)
0042   };
0043 };
0044 /// @endcond
0045 }  // namespace Acts::detail