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);
139 heapArgs.push_back(deleter);
140 return std::tuple_cat(tup, std::make_tuple(heap_arg));
142 catch (
const std::bad_alloc&) {
149template <
typename Arg,
typename... TupleElem>
150auto tuple_append(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs,
const std::tuple<TupleElem...> &tup, Arg* arg)
152 Arg* heap_arg =
nullptr;
153 if (arg !=
nullptr) {
154 heap_arg =
new(std::nothrow) Arg(*arg);
165 heapArgs.push_back(deleter);
166 return std::tuple_cat(tup, std::make_tuple(heap_arg));
168 catch (
const std::bad_alloc&) {
175template <
typename Arg,
typename... TupleElem>
176auto tuple_append(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs,
const std::tuple<TupleElem...> &tup, Arg& arg)
178 Arg* heap_arg =
new(std::nothrow) Arg(arg);
188 heapArgs.push_back(deleter);
190 auto temp = std::make_tuple(std::forward_as_tuple(*heap_arg));
191 auto new_type = std::get<0>(temp);
192 return std::tuple_cat(tup, new_type);
194 catch (
const std::bad_alloc&) {
206template<
typename... Ts>
228template<
typename Arg1,
typename... Args,
typename... Ts>
229auto make_tuple_heap(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs, std::tuple<Ts...> tup, Arg1 arg1, Args... args)
233 "std::shared_ptr reference argument not allowed");
234 static_assert(!std::is_same<Arg1, void*>::value,
"void* argument not allowed");
Delegate library options header file.
#define XALLOCATOR
Definition DelegateOpt.h:45
#define BAD_ALLOC()
Definition DelegateOpt.h:26
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
Definition DelegateOpt.h:49
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:207
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