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#if !defined(__cpp_exceptions) || defined(DMQ_ASSERTS)
140 heapArgs.push_back(deleter);
141 return std::tuple_cat(tup, std::make_tuple(heap_arg));
144 heapArgs.push_back(deleter);
145 return std::tuple_cat(tup, std::make_tuple(heap_arg));
147 catch (
const std::bad_alloc&) {
155template <
typename Arg,
typename... TupleElem>
156auto tuple_append(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs,
const std::tuple<TupleElem...> &tup, Arg* arg)
158 Arg* heap_arg =
nullptr;
159 if (arg !=
nullptr) {
160 heap_arg =
new(std::nothrow) Arg(*arg);
171#if !defined(__cpp_exceptions) || defined(DMQ_ASSERTS)
172 heapArgs.push_back(deleter);
173 return std::tuple_cat(tup, std::make_tuple(heap_arg));
176 heapArgs.push_back(deleter);
177 return std::tuple_cat(tup, std::make_tuple(heap_arg));
179 catch (
const std::bad_alloc&) {
187template <
typename Arg,
typename... TupleElem>
188auto tuple_append(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs,
const std::tuple<TupleElem...> &tup, Arg& arg)
190 Arg* heap_arg =
new(std::nothrow) Arg(arg);
200#if !defined(__cpp_exceptions) || defined(DMQ_ASSERTS)
201 heapArgs.push_back(deleter);
203 auto temp = std::make_tuple(std::forward_as_tuple(*heap_arg));
204 auto new_type = std::get<0>(temp);
205 return std::tuple_cat(tup, new_type);
208 heapArgs.push_back(deleter);
210 auto temp = std::make_tuple(std::forward_as_tuple(*heap_arg));
211 auto new_type = std::get<0>(temp);
212 return std::tuple_cat(tup, new_type);
214 catch (
const std::bad_alloc&) {
227template<
typename... Ts>
249template<
typename Arg1,
typename... Args,
typename... Ts>
250auto make_tuple_heap(
xlist<std::shared_ptr<heap_arg_deleter_base>>& heapArgs, std::tuple<Ts...> tup, Arg1 arg1, Args... args)
254 "std::shared_ptr reference argument not allowed");
255 static_assert(!std::is_same<Arg1, void*>::value,
"void* argument not allowed");
Delegate library options header file.
#define XALLOCATOR
Definition DelegateOpt.h:137
#define BAD_ALLOC()
Definition DelegateOpt.h:116
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:141
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:228
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