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