.. _program_listing_file__tmp_ws_src_proxsuite_include_proxsuite_linalg_veg_internal_collection_algo.hpp: Program Listing for File collection_algo.hpp ============================================ |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/proxsuite/include/proxsuite/linalg/veg/internal/collection_algo.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef VEG_CONTAINER_ALGOS_HPP_SGBCMQAYS #define VEG_CONTAINER_ALGOS_HPP_SGBCMQAYS #include "proxsuite/linalg/veg/memory/alloc.hpp" #include "proxsuite/linalg/veg/util/defer.hpp" #include "proxsuite/linalg/veg/internal/prologue.hpp" namespace proxsuite { namespace linalg { namespace veg { namespace _detail { namespace _collections { template struct DestroyImpl; template<> struct DestroyImpl { template VEG_INLINE static VEG_CPP14(constexpr) void fn(RefMut alloc, RefMut cloner, T* ptr, T* ptr_end) VEG_NOEXCEPT { while (true) { if (ptr_end <= ptr) { break; } --ptr_end; mem::Cloner::destroy( // RefMut(cloner), static_cast(ptr_end), RefMut(alloc)); } } }; template struct Cleanup { RefMut alloc; RefMut cloner; T* ptr; T* ptr_end; VEG_CPP14(constexpr) void operator()() noexcept { DestroyImpl::fn(alloc, cloner, ptr, ptr_end); } }; template<> struct DestroyImpl { template VEG_INLINE static VEG_CPP20(constexpr) void fn(RefMut alloc, RefMut cloner, T* ptr, T* ptr_end) VEG_NOEXCEPT_IF(false) { Defer> _{ { alloc, cloner, ptr, ptr_end } }; while (true) { if (_.fn.ptr_end <= _.fn.ptr) { break; } --_.fn.ptr_end; mem::Cloner::destroy( // RefMut(_.fn.cloner), static_cast(_.fn.ptr_end), RefMut(_.fn.alloc)); } } }; template VEG_CPP14(constexpr) void backward_destroy(RefMut alloc, RefMut cloner, T* ptr, T* ptr_end) VEG_NOEXCEPT_IF(VEG_CONCEPT(alloc::nothrow_destroy)) { DestroyImpl)>::fn( alloc, cloner, ptr, ptr_end); } } // namespace _collections } // namespace _detail } // namespace veg } // namespace linalg } // namespace proxsuite #include "proxsuite/linalg/veg/internal/epilogue.hpp" #endif /* end of include guard VEG_CONTAINER_ALGOS_HPP_SGBCMQAYS */