proxsuite 0.6.7
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
collection_algo.hpp
Go to the documentation of this file.
1#ifndef VEG_CONTAINER_ALGOS_HPP_SGBCMQAYS
2#define VEG_CONTAINER_ALGOS_HPP_SGBCMQAYS
3
7
8namespace proxsuite {
9namespace linalg {
10namespace veg {
11namespace _detail {
12namespace _collections {
13template<bool IsNoExcept>
15
16template<>
18{
19 template<typename T, typename A, typename C>
20 VEG_INLINE static VEG_CPP14(constexpr) void fn(RefMut<A> alloc,
21 RefMut<C> cloner,
22 T* ptr,
23 T* ptr_end) VEG_NOEXCEPT
24 {
25 while (true) {
26 if (ptr_end <= ptr) {
27 break;
28 }
29 --ptr_end;
31 RefMut<C>(cloner),
32 static_cast<T*>(ptr_end),
33 RefMut<A>(alloc));
34 }
35 }
36};
37
38template<typename T, typename A, typename C>
51
52template<>
54{
55 template<typename T, typename A, typename C>
56 VEG_INLINE static VEG_CPP20(constexpr) void fn(RefMut<A> alloc,
57 RefMut<C> cloner,
58 T* ptr,
59 T* ptr_end)
61 {
62
63 Defer<Cleanup<T, A, C>> _{ { alloc, cloner, ptr, ptr_end } };
64
65 while (true) {
66 if (_.fn.ptr_end <= _.fn.ptr) {
67 break;
68 }
69 --_.fn.ptr_end;
71 RefMut<C>(_.fn.cloner),
72 static_cast<T*>(_.fn.ptr_end),
73 RefMut<A>(_.fn.alloc));
74 }
75 }
76};
77
78template<typename T, typename A, typename C>
79VEG_CPP14(constexpr)
80void backward_destroy(RefMut<A> alloc, RefMut<C> cloner, T* ptr, T* ptr_end)
82{
83 DestroyImpl<VEG_CONCEPT(alloc::nothrow_destroy<C, T, A>)>::fn(
84 alloc, cloner, ptr, ptr_end);
85}
86} // namespace _collections
87} // namespace _detail
88} // namespace veg
89} // namespace linalg
90} // namespace proxsuite
91
93#endif /* end of include guard VEG_CONTAINER_ALGOS_HPP_SGBCMQAYS */
#define VEG_CONCEPT(...)
Definition macros.hpp:1243
#define VEG_INLINE
Definition macros.hpp:118
void backward_destroy(RefMut< A > alloc, RefMut< C > cloner, T *ptr, T *ptr_end)
#define VEG_NOEXCEPT
Definition prologue.hpp:30
#define VEG_CPP14(...)
Definition prologue.hpp:71
#define VEG_NOEXCEPT_IF(...)
Definition prologue.hpp:31
VEG_CPP14(constexpr) void operator()() noexcept
static VEG_INLINE VEG_CPP20(constexpr) void fn(RefMut< A > alloc
static VEG_INLINE VEG_CPP14(constexpr) void fn(RefMut< A > alloc