SpECTRE Documentation Coverage Report
Current view: top level - Utilities/TypeTraits - IsStdArrayOfSize.hpp Hit Total Coverage
Commit: 361cb8d8406bb752684a5f31c27320ec444a50e3 Lines: 3 4 75.0 %
Date: 2025-11-09 02:02:04
Legend: Lines: hit not hit

          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 <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             : /// std::bool_constant
      27             : ///
      28             : /// \semantics
      29             : /// If `T` is a std::array of size `N` then
      30             : /// \code
      31             : /// typename result::type = std::bool_constant<true>;
      32             : /// \endcode
      33             : /// otherwise
      34             : /// \code
      35             : /// typename result::type = std::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>
      43           1 : struct is_std_array_of_size : std::false_type {};
      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>
      52           1 : constexpr bool is_std_array_of_size_v = is_std_array_of_size<N, T>::value;
      53             : 
      54             : /// \see is_std_array_of_size
      55             : template <size_t N, typename T>
      56           1 : using is_std_array_of_size_t = typename is_std_array_of_size<N, T>::type;
      57             : /// @}
      58             : }  // namespace tt

Generated by: LCOV version 1.14