49 using base_t =
typename U::base_type;
51 TIMEMORY_DEFAULT_OBJECT(
stop)
53 TIMEMORY_HOT explicit
stop(
type& obj) { impl(obj); }
56 template <
typename Arg,
typename... Args>
57 TIMEMORY_HOT
stop(
type& obj, Arg&& arg, Args&&... args)
59 impl(obj, std::forward<Arg>(arg), std::forward<Args>(args)...);
62 template <
typename... Args>
65 using RetT =
decltype(sfinae(obj, 0, 0, std::forward<Args>(args)...));
68 return sfinae(obj, 0, 0, std::forward<Args>(args)...);
70 return get_return<RetT>();
73 template <
typename... Args>
76 return sfinae(obj, 0, 0, std::forward<Args>(args)...);
81 auto get_return(
enable_if_t<std::is_void<T>::value,
int> = 0)
const
85 auto get_return(
enable_if_t<!std::is_void<T>::value,
long> = 0)
const
87 static_assert(std::is_default_constructible<T>::value,
88 "Error! start() returns a type that is not default constructible! "
89 "You must specialize operation::start<T> struct");
93 template <
typename... Args>
94 TIMEMORY_HOT
void impl(
type& obj, Args&&... args)
const;
97 template <
typename Up,
typename... Args>
98 TIMEMORY_HOT
auto sfinae(Up& obj,
int,
int, Args&&... args)
const
99 ->
decltype(obj.stop(std::forward<Args>(args)...))
101 set_stopped<Tp>{}(obj);
102 return obj.stop(std::forward<Args>(args)...);
106 template <
typename Up,
typename... Args>
107 TIMEMORY_HOT
auto sfinae(Up& obj,
int,
long, Args&&...) const -> decltype(obj.
stop())
109 set_stopped<Tp>{}(obj);
114 template <
typename Up,
typename... Args>
115 void sfinae(Up&,
long,
long, Args&&...)
const
127template <
typename Tp>
134 template <
typename... Args>
139 template <
typename Up,
typename... Args>
140 TIMEMORY_HOT
auto sfinae(Up& obj, true_type&&, Args&&...
args)
146 template <
typename Up,
typename... Args>
147 TIMEMORY_INLINE
void sfinae(Up&, false_type&&, Args&&...)
157template <
typename Tp>
164 template <
typename... Args>
169 template <
typename Up,
typename... Args>
170 TIMEMORY_HOT
auto sfinae(Up& obj, true_type&&, Args&&...
args)
176 template <
typename Up,
typename... Args>
177 TIMEMORY_INLINE
void sfinae(Up&, false_type&&, Args&&...)
187template <
typename Tp>
194 template <
typename... Args>
199 template <
typename Up,
typename... Args>
200 TIMEMORY_HOT
auto sfinae(Up& obj, true_type&&, Args&&...
args)
206 template <
typename Up,
typename... Args>
207 TIMEMORY_INLINE
void sfinae(Up&, false_type&&, Args&&...)
213template <
typename Tp>
214template <
typename... Args>
216stop<Tp>::impl(type& obj, Args&&... args)
const
218 if(is_running<Tp, true>{}(obj))
220 set_stopped<Tp>{}(obj);
221 sfinae(obj, 0, 0, std::forward<Args>(args)...);
227template <
typename Tp>
228template <
typename... Args>
229priority_stop<Tp>::priority_stop(type& obj, Args&&... args)
232 conditional_t<(trait::stop_priority<Tp>::value < 0), true_type, false_type>;
233 sfinae(obj, sfinae_type{}, std::forward<Args>(args)...);
238template <
typename Tp>
239template <
typename... Args>
240standard_stop<Tp>::standard_stop(type& obj, Args&&... args)
243 conditional_t<(trait::stop_priority<Tp>::value == 0), true_type, false_type>;
244 sfinae(obj, sfinae_type{}, std::forward<Args>(args)...);
249template <
typename Tp>
250template <
typename... Args>
251delayed_stop<Tp>::delayed_stop(type& obj, Args&&... args)
254 conditional_t<(trait::stop_priority<Tp>::value > 0), true_type, false_type>;
255 sfinae(obj, sfinae_type{}, std::forward<Args>(args)...);
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
typename std::conditional< B, Lhs, Rhs >::type conditional_t
The declaration for the types for operations without definitions.
#define SFINAE_WARNING(...)
Include the macros for operations.
Declare the operations types.
TIMEMORY_DELETED_OBJECT(delayed_stop) template< typename... Args > explicit delayed_stop(type &obj
This operation attempts to call a member function which provides whether or not the component current...
TIMEMORY_DELETED_OBJECT(priority_stop) template< typename... Args > explicit priority_stop(type &obj
TIMEMORY_DELETED_OBJECT(standard_stop) template< typename... Args > explicit standard_stop(type &obj
typename U::base_type base_t
stop(type &obj, quirk::unsafe &&)
stop(type &obj, Arg &&arg, Args &&... args)
auto operator()(type &obj, quirk::unsafe &&, Args &&... args) const
auto operator()(type &obj, Args &&... args) const
When present, this argument instructs to skip any safety checks. Example checks include: checking whe...