Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <array> 7 : #include <type_traits> 8 : 9 : namespace tt { 10 : /// @{ 11 : /// \ingroup TypeTraitsGroup 12 : /// \brief Check if type T is a std::array 13 : /// 14 : /// \details 15 : /// Given a type `T` derives from std::true_type if `T` is a std::array and from 16 : /// std::false_type if `T` is not a std::array. 17 : /// 18 : /// \usage 19 : /// For any type `T` 20 : /// \code 21 : /// using result = tt::is_std_array<T>; 22 : /// \endcode 23 : /// 24 : /// \metareturns 25 : /// std::bool_constant 26 : /// 27 : /// \semantics 28 : /// If `T` is a std::array then 29 : /// \code 30 : /// typename result::type = std::bool_constant<true>; 31 : /// \endcode 32 : /// otherwise 33 : /// \code 34 : /// typename result::type = std::bool_constant<false>; 35 : /// \endcode 36 : /// 37 : /// \example 38 : /// \snippet Test_IsStdArray.cpp is_std_array_example 39 : /// \see is_a is_std_array_of_size 40 : /// \tparam T the type to check 41 : template <typename T> 42 1 : struct is_std_array : std::false_type {}; 43 : 44 : /// \cond HIDDEN_SYMBOLS 45 : template <typename T, size_t N> 46 : struct is_std_array<std::array<T, N>> : std::true_type {}; 47 : /// \endcond 48 : 49 : /// \see is_std_array 50 : template <typename T> 51 1 : constexpr bool is_std_array_v = is_std_array<T>::value; 52 : 53 : /// \see is_std_array 54 : template <typename T> 55 1 : using is_std_array_t = typename is_std_array<T>::type; 56 : /// @} 57 : } // namespace tt