SpECTRE Documentation Coverage Report
Current view: top level - Utilities - MemoryHelpers.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 20.0 % 5 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 <cstddef>
       7              : #include <memory>
       8              : #include <type_traits>
       9              : 
      10              : namespace cpp20 {
      11              : namespace detail {
      12              : template <typename T>
      13              : struct unique_type {
      14              :   using single_object = std::unique_ptr<T>;
      15              : };
      16              : 
      17              : template <typename T>
      18              : struct unique_type<T[]> {
      19              :   using array = std::unique_ptr<T[]>;
      20              : };
      21              : 
      22              : template<typename T, size_t Bound>
      23              : struct unique_type<T[Bound]> { struct invalid_type { }; };
      24              : }  // namespace detail
      25              : 
      26              : template <typename T, typename... Args>
      27            0 : typename detail::unique_type<T>::single_object make_unique_for_overwrite() {
      28              :   return std::unique_ptr<T>(new T);
      29              : }
      30              : 
      31              : template <typename T>
      32            0 : typename detail::unique_type<T>::array make_unique_for_overwrite(
      33              :     const size_t num) {
      34              :   return std::unique_ptr<T>(new std::remove_extent_t<T>[num]);
      35              : }
      36              : 
      37              : template <typename T, typename... Args>
      38            0 : typename detail::unique_type<T>::invalid_type make_unique_for_overwrite(
      39              :     Args&&...) = delete;
      40              : }  // namespace cpp20
      41              : 
      42              : /// Install a memory allocation failure handler that calls ERROR()
      43              : /// instead of throwing an exception.
      44            1 : void setup_memory_allocation_failure_reporting();
        

Generated by: LCOV version 2.0-1