SpECTRE Documentation Coverage Report
Current view: top level - Utilities/TypeTraits - CanBeCopyConstructed.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 33.3 % 3 1
Test Date: 2026-10-22 17:29:42
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 <type_traits>
       7              : 
       8              : namespace tt {
       9              : /// @{
      10              : /*!
      11              :  * \ingroup TypeTraitsGroup
      12              :  * \brief Check if `T` is copy constructible
      13              :  *
      14              :  * The STL `std::is_copy_constructible` does not work as expected with some
      15              :  * types, such as `std::unordered_map`. This is because
      16              :  * `std::is_copy_constructible` only checks that the copy construction call is
      17              :  * well-formed, not that it could actually be done in practice. To get around
      18              :  * this for containers we check that `T::value_type` is also copy constructible.
      19              :  */
      20              : template <typename T, typename = void>
      21            1 : struct can_be_copy_constructed : std::is_copy_constructible<T> {};
      22              : 
      23              : /// \cond
      24              : template <typename T>
      25              : struct can_be_copy_constructed<T, std::void_t<typename T::value_type>>
      26              :     : std::bool_constant<std::is_copy_constructible_v<T> and
      27              :                          std::is_copy_constructible_v<typename T::value_type>> {
      28              : };
      29              : /// \endcond
      30              : 
      31              : template <typename T>
      32            0 : constexpr bool can_be_copy_constructed_v = can_be_copy_constructed<T>::value;
      33              : /// @}
      34              : }  // namespace tt
        

Generated by: LCOV version 2.0-1