50 decay_t<
decltype(operation::get_storage<Up>{}(std::declval<Up&>()))>,
51 std::nullptr_t>::value;
69 (*this)(obj, _scope, _hash);
80 return sfinae(obj, 0, 0, 0, _scope, _hash);
91 template <
typename Up,
typename... Args>
92 auto sfinae(Up& obj,
int,
int,
int, Args&&... args)
const
93 ->
decltype(obj.push(std::forward<Args>(args)...))
95 return obj.push(std::forward<Args>(args)...);
99 template <
typename Up,
typename... Args>
100 auto sfinae(Up& obj,
int,
int,
long, Args&&...) const -> decltype(obj.
push())
106 template <
typename Up,
typename Vp =
typename Up::value_type,
107 typename StorageT = storage<Up, Vp>,
108 enable_if_t<trait::uses_value_storage<Up, Vp>::value,
int> = 0>
109 TIMEMORY_HOT
auto sfinae(Up& _obj,
int,
long,
long, scope::config _scope,
111 enable_if_t<!storage_is_nullptr_t<Up>(),
int> = 0) const
112 -> decltype(_obj.get_iterator())
114 using storage_type = StorageT;
115 constexpr bool force_flat_v = trait::flat_storage<Tp>::value;
116 constexpr bool force_time_v = trait::timeline_storage<Tp>::value;
117 if(!operation::get_is_on_stack<type, false>{}(_obj))
120 operation::set_is_on_stack<type>{}(_obj,
true);
121 operation::set_is_flat<type>{}(_obj, _scope.is_flat() || force_flat_v);
123 auto _storage = operation::get_storage<type>{}(_obj);
129 auto _beg_depth = operation::get_depth<storage_type>{}(*_storage);
131 if(!operation::get_is_flat<type, false>{}(_obj))
136 operation::set_is_on_stack<type>{}(_obj,
false);
141 operation::set_iterator<type>{}(
142 _obj, operation::insert<storage_type>{}(*_storage, _scope, _obj, _hash));
144 auto _end_depth = operation::get_depth<storage_type>{}(*_storage);
146 operation::set_depth_change<type>{}(
148 (_beg_depth < _end_depth) || (_scope.is_timeline() || force_time_v));
150 operation::stack_push<storage_type>{}(*_storage, &_obj);
152 return _obj.get_iterator();
156 template <
typename Up,
typename... Args>
157 void sfinae(Up&,
long,
long,
long, Args&&...)
const
166template <
typename Tp>
175 template <
typename Arg,
typename... Args>
178 (*this)(obj, std::forward<Arg>(arg), std::forward<Args>(args)...);
183 template <
typename Arg,
typename... Args>
186 return sfinae(obj, 0, 0, 0, std::forward<Arg>(arg), std::forward<Args>(args)...);
191 template <
typename Up,
typename... Args>
192 auto sfinae(Up& obj,
int,
int,
int, Args&&... args)
const
193 ->
decltype(obj.pop(std::forward<Args>(args)...))
195 return obj.pop(std::forward<Args>(args)...);
199 template <
typename Up,
typename... Args>
200 auto sfinae(Up& obj,
int,
int,
long, Args&&...) const -> decltype(obj.
pop())
206 template <
typename Up,
typename Vp =
typename Up::value_type,
207 typename StorageT = storage<Up, Vp>,
208 enable_if_t<trait::uses_value_storage<Up, Vp>::value,
int> = 0>
209 TIMEMORY_HOT
auto sfinae(Up& _obj,
int,
long,
long,
210 enable_if_t<!storage_is_nullptr_t<Up>(),
int> = 0) const
211 -> decltype(_obj.get_iterator())
213 using storage_type = StorageT;
216 if(operation::get_is_invalid<Up, false>{}(_obj))
219 if(operation::get_is_on_stack<type, true>{}(_obj) && _obj.get_iterator())
221 auto _storage = operation::get_storage<type>{}(_obj);
222 assert(_storage !=
nullptr);
228 operation::set_is_on_stack<type>{}(_obj,
false);
229 auto&& itr = _obj.get_iterator();
230 type& targ = itr->obj();
231 auto& stats = itr->stats();
234 operation::set_depth_change<type>{}(_obj,
false);
235 operation::set_is_invalid<type>{}(targ,
false);
237 operation::plus<type>(targ, _obj);
239 operation::add_secondary<type>(_storage, itr, _obj);
241 operation::add_statistics<type>(_obj, stats);
243 if(!storage_type::is_finalizing())
245 if(operation::get_is_flat<type, false>{}(_obj))
248 operation::stack_pop<storage_type>{}(*_storage, &_obj);
253 auto _beg_depth = operation::get_depth<storage_type>{}(_storage);
254 operation::pop<storage_type>{}(*_storage);
255 operation::stack_pop<storage_type>{}(*_storage, &_obj);
257 auto _end_depth = operation::get_depth<storage_type>{}(_storage);
258 operation::set_depth_change<type>{}(_obj, _beg_depth > _end_depth);
261 operation::set_is_running<type>{}(targ,
false);
263 return _obj.get_iterator();
267 template <
typename Up,
typename... Args>
268 void sfinae(Up&,
long,
long,
long, Args&&...)
const
Definition for various functions for add_secondary in operations.
Definition for various functions for add_statistics in operations.
hash_value_t get_hash_id(Tp &&_prefix)
void pop(TupleT< Tp... > &obj, Args &&... args)
void push(TupleT< Tp... > &obj, Args &&... args)
const std::string & string_view_cref_t
typename std::decay< T >::type decay_t
Alias template for decay.
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
char argparse::argument_parser tim::settings * _settings
The declaration for the types for operations without definitions.
Include the macros for operations.
Definition for various functions for math in operations.
Declare the operations types.
auto operator()(type &obj, Arg &&arg, Args &&... args) const
auto operator()(type &obj) const
pop_node(type &obj, Arg &&arg, Args &&... args)
auto operator()(type &obj, scope::config _scope, string_view_cref_t _key) const
push_node(type &obj, scope::config _scope, string_view_cref_t _key)
auto operator()(type &obj, scope::config _scope, hash_value_t _hash) const
this data type encodes the options of storage scope. The default is hierarchical (tree) scope....
static settings * instance()