53template <
typename Tp,
typename Op,
typename Tag>
56 using type = std::remove_pointer_t<Tp>;
61 template <
typename Up>
64 using U = std::decay_t<std::remove_pointer_t<Up>>;
65 static_assert(std::is_same<U, type>::value,
"Error! Up != type");
78 if(supports_runtime_checks &&
88 template <
typename Up>
106 template <
typename Up,
typename... Args,
typename Rp =
type,
117 sfinae(obj, 0, 0, 0, std::forward<Args>(args)...);
120 template <
typename Up,
typename... Args,
typename Rp =
type,
131 sfinae(obj, rhs, 0, 0, 0, std::forward<Args>(args)...);
136 template <
typename Up,
typename... Args>
137 TIMEMORY_INLINE
auto pointer_sfinae(Up obj,
int,
int,
int, Args&&... args)
138 ->
decltype(Op(*obj, std::forward<Args>(args)...), void())
140 Op{ *obj, std::forward<Args>(args)... };
143 template <
typename Up,
typename... Args,
144 enable_if_t<std::is_default_constructible<Tp>::value> = 0>
145 TIMEMORY_INLINE
auto pointer_sfinae(Up obj,
int,
int,
long, Args&&... args)
146 ->
decltype(std::declval<Op>()(*obj, std::forward<Args>(args)...), void())
148 Op{}(*obj, std::forward<Args>(args)...);
151 template <
typename Up,
typename... Args>
152 TIMEMORY_INLINE
auto pointer_sfinae(Up obj,
int,
long,
long, Args&&...)
153 ->
decltype(Op{ *obj }, void())
158 template <
typename Up,
typename... Args>
159 TIMEMORY_INLINE
void pointer_sfinae(Up,
long,
long,
long, Args&&...)
164 template <
typename Up,
typename... Args>
165 TIMEMORY_INLINE
auto pointer_sfinae(Up obj, Up rhs,
int,
int,
int, Args&&... args)
166 ->
decltype(Op(*obj, *rhs, std::forward<Args>(args)...), void())
168 Op{ *obj, *rhs, std::forward<Args>(args)... };
171 template <
typename Up,
typename... Args,
172 enable_if_t<std::is_default_constructible<Tp>::value> = 0>
173 TIMEMORY_INLINE
auto pointer_sfinae(Up obj, Up rhs,
int,
int,
long, Args&&... args)
174 ->
decltype(std::declval<Op>()(*obj, *rhs, std::forward<Args>(args)...), void())
176 Op{}(*obj, *rhs, std::forward<Args>(args)...);
179 template <
typename Up,
typename... Args>
180 TIMEMORY_INLINE
auto pointer_sfinae(Up obj, Up rhs,
int,
long,
long, Args&&...)
181 ->
decltype(Op(*obj, *rhs), void())
186 template <
typename Up,
typename... Args>
187 TIMEMORY_INLINE
void pointer_sfinae(Up, Up,
long,
long,
long, Args&&...)
196 template <
typename Up,
typename... Args,
typename Rp = Tp,
197 enable_if_t<trait::is_available<Rp>::value,
int> = 0,
198 enable_if_t<!std::is_pointer<Up>::value,
int> = 0>
207 sfinae(obj, 0, 0, 0, std::forward<Args>(args)...);
210 template <
typename Up,
typename... Args,
typename Rp = Tp,
221 sfinae(obj, rhs, 0, 0, 0, std::forward<Args>(args)...);
226 template <
typename Up,
typename... Args>
227 TIMEMORY_INLINE
auto sfinae(Up& obj,
int,
int,
int, Args&&... args)
228 ->
decltype(Op(obj, std::forward<Args>(args)...), void())
230 Op{ obj, std::forward<Args>(args)... };
233 template <
typename Up,
typename... Args,
234 enable_if_t<std::is_default_constructible<Tp>::value> = 0>
235 TIMEMORY_INLINE
auto sfinae(Up& obj,
int,
int,
long, Args&&... args)
236 ->
decltype(std::declval<Op>()(obj, std::forward<Args>(args)...), void())
238 Op{}(obj, std::forward<Args>(args)...);
241 template <
typename Up,
typename... Args>
242 TIMEMORY_INLINE
auto sfinae(Up& obj,
int,
long,
long, Args&&...)
243 ->
decltype(Op{ obj }, void())
248 template <
typename Up,
typename... Args,
249 enable_if_t<std::is_pointer<Up>::value,
int> = 0>
250 TIMEMORY_INLINE
void sfinae(Up& obj,
long,
long,
long, Args&&... args)
253 pointer_sfinae(obj, 0, 0, 0, std::forward<Args>(args)...);
256 template <
typename Up,
typename... Args,
257 enable_if_t<!std::is_pointer<Up>::value,
int> = 0>
258 TIMEMORY_INLINE
void sfinae(Up&,
long,
long,
long, Args&&...)
263 template <
typename Up,
typename... Args>
264 TIMEMORY_INLINE
auto sfinae(Up& obj, Up& rhs,
int,
int,
int, Args&&... args)
265 ->
decltype(Op(obj, rhs, std::forward<Args>(args)...), void())
267 Op{ obj, rhs, std::forward<Args>(args)... };
270 template <
typename Up,
typename... Args,
271 enable_if_t<std::is_default_constructible<Tp>::value> = 0>
272 TIMEMORY_INLINE
auto sfinae(Up& obj, Up& rhs,
int,
int,
long, Args&&... args)
273 ->
decltype(std::declval<Op>()(obj, rhs, std::forward<Args>(args)...), void())
275 Op{}(obj, rhs, std::forward<Args>(args)...);
278 template <
typename Up,
typename... Args>
279 TIMEMORY_INLINE
auto sfinae(Up& obj, Up& rhs,
int,
long,
long, Args&&...)
280 ->
decltype(Op(obj, rhs), void())
285 template <
typename Up,
typename... Args,
286 enable_if_t<std::is_pointer<Up>::value,
int> = 0>
287 TIMEMORY_INLINE
void sfinae(Up& obj, Up& rhs,
long,
long,
long, Args&&... args)
290 pointer_sfinae(obj, rhs, 0, 0, 0, std::forward<Args>(args)...);
293 template <
typename Up,
typename... Args,
294 enable_if_t<!std::is_pointer<Up>::value,
int> = 0>
295 TIMEMORY_INLINE
void sfinae(Up&, Up&,
long,
long,
long, Args&&...)
305 template <
typename Up,
typename... Args,
typename Rp = Tp,
306 enable_if_t<!trait::is_available<Rp>::value,
int> = 0>
317template <
typename Tp>
327 demangle<type>().c_str(), (
void*) obj);
332 template <typename Up, enable_if_t<std::is_pointer<Up>::value,
int> = 0>
336 demangle<type>().c_str(), (
void*) obj);
338 std::ref(std::forward<Up>(obj)).get() =
nullptr;
341 template <
typename... Deleter>
344 DEBUG_PRINT_HERE(
"%s %s :: %p",
"deleting unique_ptr", demangle<type>().c_str(),
351 DEBUG_PRINT_HERE(
"%s %s :: %p",
"deleting shared_ptr", demangle<type>().c_str(),
356 template <typename Up, enable_if_t<!std::is_pointer<Up>::value,
int> = 0>
367template <
typename Tp>
374 template <typename Up, enable_if_t<std::is_pointer<Up>::value,
int> = 0>
375 TIMEMORY_INLINE
explicit generic_counter(
const Up& obj, uint64_t& count)
381 template <typename Up, enable_if_t<!std::is_pointer<Up>::value,
int> = 0>
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
typename impl::is_one_of< Tp, Types > is_one_of
check if type is in expansion
lightweight tuple-alternative for meta-programming logic
The declaration for the types for operations without definitions.
Include the macros for operations.
Declare the operations types.
TIMEMORY_DELETED_OBJECT(generic_counter) template< typename Up
generic_deleter(std::unique_ptr< type, Deleter... > &obj)
TIMEMORY_DELETED_OBJECT(generic_deleter) explicit generic_deleter(type *&obj)
generic_deleter(std::shared_ptr< type > obj)
generic_deleter(Up &&obj)
This operation class is similar to pointer_operator but can handle non-pointer types.
generic_operator(Up &obj, Up &rhs, Args &&... args)
static bool is_invalid(Up &obj)
generic_operator(Up &, Args &&...)
TIMEMORY_DELETED_OBJECT(generic_operator) private
std::remove_pointer_t< Tp > type
generic_operator(Up &obj, Args &&... args)
generic_operator(Up obj, Up rhs, Args &&... args)
generic_operator(Up obj, Args &&... args)
This operation attempts to call a member function which provides whether or not the component is in a...
trait that signifies that an implementation is enabled at runtime. The value returned from get() is f...
static bool get(enable_if_t< is_available< U >::value &&get_value< U >(), int >=0)
GET specialization if component is available.
#define DEBUG_PRINT_HERE(...)