1#ifndef _MAKE_TUPLE_HEAP_H
2#define _MAKE_TUPLE_HEAP_H
106template <
typename Arg,
typename... TupleElem>
107auto tuple_append(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs,
const std::tuple<TupleElem...> &tup, Arg** arg)
109 Arg** heap_arg =
nullptr;
112 if (arg !=
nullptr && *arg !=
nullptr) {
114 heap_arg =
new(std::nothrow) Arg * ();
119 *heap_arg =
new(std::nothrow) Arg(**arg);
127 heap_arg =
new(std::nothrow) Arg * (
nullptr);
137 heapArgs.push_back(deleter);
138 return std::tuple_cat(tup, std::make_tuple(heap_arg));
140 catch (
const std::bad_alloc&) {
147template <
typename Arg,
typename... TupleElem>
148auto tuple_append(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs,
const std::tuple<TupleElem...> &tup, Arg* arg)
150 Arg* heap_arg =
nullptr;
151 if (arg !=
nullptr) {
152 heap_arg =
new(std::nothrow) Arg(*arg);
162 heapArgs.push_back(deleter);
163 return std::tuple_cat(tup, std::make_tuple(heap_arg));
165 catch (
const std::bad_alloc&) {
172template <
typename Arg,
typename... TupleElem>
173auto tuple_append(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs,
const std::tuple<TupleElem...> &tup, Arg& arg)
175 Arg* heap_arg =
new(std::nothrow) Arg(arg);
184 heapArgs.push_back(deleter);
186 auto temp = std::make_tuple(std::forward_as_tuple(*heap_arg));
187 auto new_type = std::get<0>(temp);
188 return std::tuple_cat(tup, new_type);
190 catch (
const std::bad_alloc&) {
202template<
typename... Ts>
224template<
typename Arg1,
typename... Args,
typename... Ts>
225auto make_tuple_heap(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs, std::tuple<Ts...> tup, Arg1 arg1, Args... args)
229 "std::shared_ptr reference argument not allowed");
230 static_assert(!std::is_same<Arg1, void*>::value,
"void* argument not allowed");
Delegate library options header file.
#define XALLOCATOR
Definition DelegateOpt.h:46
std::list< T, Alloc > xlist
Definition DelegateOpt.h:40
#define BAD_ALLOC()
Definition DelegateOpt.h:22
heap_arg_deleter(T *arg)
Definition make_tuple_heap.h:83
virtual ~heap_arg_deleter()
Definition make_tuple_heap.h:84
heap_arg_deleter(T **arg)
Definition make_tuple_heap.h:96
virtual ~heap_arg_deleter()
Definition make_tuple_heap.h:97
Base class for all deleter's.
Definition make_tuple_heap.h:58
virtual ~heap_arg_deleter_base()=default
Frees heap memory for reference heap argument.
Definition make_tuple_heap.h:68
virtual ~heap_arg_deleter()
Definition make_tuple_heap.h:71
heap_arg_deleter(T &arg)
Definition make_tuple_heap.h:70
The delegate library namespace.
Definition Delegate.h:27
auto make_tuple_heap(xlist< std::shared_ptr< heap_arg_deleter_base > > &heapArgs, std::tuple< Ts... > tup)
Terminate the template metaprogramming argument loop. This function is called when there are no more ...
Definition make_tuple_heap.h:203
auto tuple_append(xlist< std::shared_ptr< heap_arg_deleter_base > > &heapArgs, const std::tuple< TupleElem... > &tup, Arg **arg)
Append a pointer to pointer argument to the tuple.
Definition make_tuple_heap.h:107
Definition make_tuple_heap.h:33
Definition make_tuple_heap.h:51