timemory  3.2.1
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::lightweight_tuple< Types > Class Template Reference

This is a variadic component wrapper which provides the least amount of runtime and compilation overhead. More...

#include "timemory/variadic/lightweight_tuple.hpp"

+ Collaboration diagram for tim::lightweight_tuple< Types >:

Public Types

using captured_location_t = source_location::captured
 
using this_type = lightweight_tuple< Types... >
 
using type_list_type = type_list< Types... >
 
using data_type = typename bundle_type::data_type
 
using tuple_type = typename bundle_type::tuple_type
 
using sample_type = typename bundle_type::sample_type
 
using reference_type = typename bundle_type::reference_type
 
using user_bundle_types = typename bundle_type::user_bundle_types
 
using size_type = typename bundle_type::size_type
 
using string_t = typename bundle_type::string_t
 
template<template< typename > class Op, typename Tuple = impl_type>
using operation_t = typename bundle_type::template generic_operation< Op, Tuple >::type
 
template<template< typename > class Op, typename Tuple = impl_type>
using custom_operation_t = typename bundle_type::template custom_operation< Op, Tuple >::type
 
using auto_type = mpl::append_type_t< quirk::auto_start, this_type >
 
using component_type = mpl::remove_type_t< quirk::auto_start, this_type >
 
using type = convert_t< tuple_type, lightweight_tuple<> >
 
using initializer_type = std::function< void(this_type &)>
 
using transient_func_t = utility::transient_function< void(this_type &)>
 
template<typename T , typename... U>
using quirk_config = tim::variadic::impl::quirk_config< T, type_list< Types... >, U... >
 

Public Member Functions

 lightweight_tuple ()=default
 
template<typename... T>
 lightweight_tuple (const string_t &key, quirk::config< T... >={}, transient_func_t=get_initializer())
 
template<typename... T>
 lightweight_tuple (const captured_location_t &loc, quirk::config< T... >={}, transient_func_t=get_initializer())
 
template<typename... T>
 lightweight_tuple (size_t _hash, quirk::config< T... >={}, transient_func_t=get_initializer())
 
 lightweight_tuple (size_t _hash, scope::config _scope, transient_func_t=get_initializer())
 
 lightweight_tuple (const string_t &key, scope::config _scope, transient_func_t=get_initializer())
 
 lightweight_tuple (const captured_location_t &loc, scope::config _scope, transient_func_t=get_initializer())
 
 ~lightweight_tuple ()
 
 lightweight_tuple (const lightweight_tuple &)=default
 
 lightweight_tuple (lightweight_tuple &&) noexcept=default
 
lightweight_tupleoperator= (const lightweight_tuple &rhs)=default
 
lightweight_tupleoperator= (lightweight_tuple &&) noexcept=default
 
lightweight_tuple clone (bool store, scope::config _scope=scope::get_default())
 
this_typepush ()
 
this_typepop ()
 
template<typename... Args>
this_typemeasure (Args &&...)
 
template<typename... Args>
this_typesample (Args &&...)
 
template<typename... Args>
this_typestart (Args &&...)
 
template<typename... Args>
this_typestop (Args &&...)
 
template<typename... Args>
this_typerecord (Args &&...)
 
template<typename... Args>
this_typereset (Args &&...)
 
template<typename... Args>
auto get (Args &&...) const
 
template<typename... Args>
auto get_labeled (Args &&...) const
 
data_typedata ()
 
const data_typedata () const
 
this_typeset_scope (scope::config)
 
template<typename FuncT , typename... Args>
decltype(auto) execute (FuncT &&func, Args &&... args)
 when chaining together operations, this function enables executing a function inside the chain More...
 
template<typename... Args>
this_typeconstruct (Args &&... _args)
 construct the objects that have constructors with matching arguments More...
 
this_typeassemble ()
 provide preliminary info to the objects with matching arguments. This is typically used to notify a component that it has been bundled alongside another component that it can extract data from. More...
 
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_typeassemble (Args &&... _args)
 
this_typederive ()
 provide conclusive info to the objects with matching arguments. This is typically used by components to extract data from another component it has been bundled alongside, e.g. the cpu_util component can extract data from tim::component::wall_clock and tim::component::cpu_clock More...
 
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_typederive (Args &&... _args)
 
template<typename... Args>
this_typemark_begin (Args &&... _args)
 mark a beginning position in the execution (typically used by asynchronous structures) More...
 
template<typename... Args>
this_typemark_end (Args &&... _args)
 mark a beginning position in the execution (typically used by asynchronous structures) More...
 
template<typename... Args>
this_typestore (Args &&... _args)
 store a value More...
 
template<typename... Args>
this_typeaudit (Args &&... _args)
 allow the components to inspect the incoming arguments before start or out-going return value before returning (typically using in GOTCHA components) More...
 
template<template< typename > class OpT, typename... Args>
this_typeinvoke (Args &&... _args)
 apply a user-defined operation to all the components More...
 
template<template< typename > class OpT, typename... Tp, typename... Args>
this_typeinvoke (mpl::piecewise_select< Tp... >, Args &&... _args)
 generic member function for invoking user-provided operations on a specific set of component types More...
 
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
T * get ()
 get member functions taking either a type More...
 
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
const T * get () const
 
template<typename T , enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
T * get () const
 
this_typeget (void *&ptr, size_t _hash) const
 
template<typename U , typename T = std::remove_pointer_t<decay_t<U>>, enable_if_t< trait::is_available< T >::value &&is_one_of< T, data_type >::value, int > = 0>
auto get_component ()
 this is a simple alternative to get<T>() when used from SFINAE in operation namespace which has a struct get also templated. Usage there can cause error with older compilers More...
 
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&has_user_bundle_v, int > = 0>
bool init (Args &&...)
 
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&!has_user_bundle_v, int > = 0>
bool init (Args &&...)
 
template<typename... T, typename... Args>
auto initialize (Args &&... args)
 variadic initialization More...
 
template<typename T , typename Func , typename... Args, enable_if_t< is_one_of< T, data_type >::value, int > = 0>
this_typetype_apply (Func &&_func, Args &&... _args)
 apply a member function to a type that is in variadic list AND is available More...
 
template<typename T , typename Func , typename... Args, enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
this_typetype_apply (Func &&, Args &&...)
 
this_typeoperator-= (const this_type &rhs)
 
this_typeoperator-= (this_type &rhs)
 
this_typeoperator+= (const this_type &rhs)
 
this_typeoperator+= (this_type &rhs)
 
template<typename Op >
this_typeoperator-= (Op &&rhs)
 
template<typename Op >
this_typeoperator+= (Op &&rhs)
 
template<typename Op >
this_typeoperator*= (Op &&rhs)
 
template<typename Op >
this_typeoperator/= (Op &&rhs)
 
template<bool PrintPrefix = true, bool PrintLaps = true>
this_typeprint (std::ostream &os, bool skip_wo_hash=true) const
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int)
 
int64_t laps () const
 
std::string key () const
 
uint64_t hash () const
 
bool & store ()
 
const bool & store () const
 
auto prefix () const
 
auto get_prefix () const
 
void rekey (const string_t &_key)
 
void rekey (const captured_location_t &_loc)
 
void rekey (uint64_t _hash)
 
template<typename... Args>
lightweight_tuple< Types... > & measure (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & sample (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & start (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & stop (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & record (Args &&... args)
 
template<typename... Args>
lightweight_tuple< Types... > & reset (Args &&... args)
 
template<typename... Args>
auto get (Args &&... args) const
 
template<typename... Args>
auto get_labeled (Args &&... args) const
 

Static Public Member Functions

static initializer_typeget_initializer ()
 
static constexpr std::size_t size ()
 
static void init_storage ()
 requests the component initialize their storage More...
 

Static Public Attributes

static constexpr bool has_gotcha_v = bundle_type::has_gotcha_v
 
static constexpr bool has_user_bundle_v = bundle_type::has_user_bundle_v
 

Protected Types

using apply_v = mpl::apply< void >
 
using bundle_type = stack_bundle< mpl::available_t< type_list< Types... > >>
 
using impl_type = typename bundle_type::impl_type
 

Protected Member Functions

data_typeget_data ()
 
const data_typeget_data () const
 
void set_prefix (const string_t &) const
 
void set_prefix (size_t) const
 

Protected Attributes

data_type m_data = data_type{}
 

Friends

template<typename... Tp>
class impl::base_bundle
 
this_type operator+ (const this_type &lhs, const this_type &rhs)
 
this_type operator- (const this_type &lhs, const this_type &rhs)
 
template<typename Op >
this_type operator* (const this_type &lhs, Op &&rhs)
 
template<typename Op >
this_type operator/ (const this_type &lhs, Op &&rhs)
 
std::ostream & operator<< (std::ostream &os, const this_type &obj)
 

Detailed Description

template<typename... Types>
class tim::lightweight_tuple< Types >

This is a variadic component wrapper which provides the least amount of runtime and compilation overhead.

Template Parameters
TypesSpecification of the component types to bundle together

Definition at line 67 of file lightweight_tuple.hpp.

Member Typedef Documentation

◆ apply_v

template<typename... Types>
using tim::lightweight_tuple< Types >::apply_v = mpl::apply<void>
protected

Definition at line 72 of file lightweight_tuple.hpp.

◆ auto_type

template<typename... Types>
using tim::lightweight_tuple< Types >::auto_type = mpl::append_type_t<quirk::auto_start, this_type>

Definition at line 101 of file lightweight_tuple.hpp.

◆ bundle_type

template<typename... Types>
using tim::lightweight_tuple< Types >::bundle_type = stack_bundle<mpl::available_t<type_list<Types...> >>
protected

Definition at line 73 of file lightweight_tuple.hpp.

◆ captured_location_t

template<typename... Types>
using tim::lightweight_tuple< Types >::captured_location_t = source_location::captured

Definition at line 80 of file lightweight_tuple.hpp.

◆ component_type

template<typename... Types>
using tim::lightweight_tuple< Types >::component_type = mpl::remove_type_t<quirk::auto_start, this_type>

Definition at line 102 of file lightweight_tuple.hpp.

◆ custom_operation_t

template<typename... Types>
template<template< typename > class Op, typename Tuple = impl_type>
using tim::lightweight_tuple< Types >::custom_operation_t = typename bundle_type::template custom_operation<Op, Tuple>::type

Definition at line 98 of file lightweight_tuple.hpp.

◆ data_type

template<typename... Types>
using tim::lightweight_tuple< Types >::data_type = typename bundle_type::data_type

Definition at line 85 of file lightweight_tuple.hpp.

◆ impl_type

template<typename... Types>
using tim::lightweight_tuple< Types >::impl_type = typename bundle_type::impl_type
protected

Definition at line 74 of file lightweight_tuple.hpp.

◆ initializer_type

template<typename... Types>
using tim::lightweight_tuple< Types >::initializer_type = std::function<void(this_type&)>

Definition at line 104 of file lightweight_tuple.hpp.

◆ operation_t

template<typename... Types>
template<template< typename > class Op, typename Tuple = impl_type>
using tim::lightweight_tuple< Types >::operation_t = typename bundle_type::template generic_operation<Op, Tuple>::type

Definition at line 95 of file lightweight_tuple.hpp.

◆ quirk_config

template<typename... Types>
template<typename T , typename... U>
using tim::lightweight_tuple< Types >::quirk_config = tim::variadic::impl::quirk_config<T, type_list<Types...>, U...>

Definition at line 118 of file lightweight_tuple.hpp.

◆ reference_type

template<typename... Types>
using tim::lightweight_tuple< Types >::reference_type = typename bundle_type::reference_type

Definition at line 88 of file lightweight_tuple.hpp.

◆ sample_type

template<typename... Types>
using tim::lightweight_tuple< Types >::sample_type = typename bundle_type::sample_type

Definition at line 87 of file lightweight_tuple.hpp.

◆ size_type

template<typename... Types>
using tim::lightweight_tuple< Types >::size_type = typename bundle_type::size_type

Definition at line 91 of file lightweight_tuple.hpp.

◆ string_t

template<typename... Types>
using tim::lightweight_tuple< Types >::string_t = typename bundle_type::string_t

Definition at line 92 of file lightweight_tuple.hpp.

◆ this_type

template<typename... Types>
using tim::lightweight_tuple< Types >::this_type = lightweight_tuple<Types...>

Definition at line 82 of file lightweight_tuple.hpp.

◆ transient_func_t

template<typename... Types>
using tim::lightweight_tuple< Types >::transient_func_t = utility::transient_function<void(this_type&)>

Definition at line 105 of file lightweight_tuple.hpp.

◆ tuple_type

template<typename... Types>
using tim::lightweight_tuple< Types >::tuple_type = typename bundle_type::tuple_type

Definition at line 86 of file lightweight_tuple.hpp.

◆ type

template<typename... Types>
using tim::lightweight_tuple< Types >::type = convert_t<tuple_type, lightweight_tuple<> >

Definition at line 103 of file lightweight_tuple.hpp.

◆ type_list_type

template<typename... Types>
using tim::lightweight_tuple< Types >::type_list_type = type_list<Types...>

Definition at line 83 of file lightweight_tuple.hpp.

◆ user_bundle_types

template<typename... Types>
using tim::lightweight_tuple< Types >::user_bundle_types = typename bundle_type::user_bundle_types

Definition at line 89 of file lightweight_tuple.hpp.

Constructor & Destructor Documentation

◆ lightweight_tuple() [1/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( )
default

◆ lightweight_tuple() [2/9]

template<typename... Types>
template<typename... T>
tim::lightweight_tuple< Types >::lightweight_tuple ( const string_t key,
quirk::config< T... >  _config = {},
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 44 of file lightweight_tuple.cpp.

47 : bundle_type(bundle_type::handle(type_list_type{}, _key, false_type{}, _config))
48 , m_data(invoke::construct<data_type>(_key, _config))
49 {
50  bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func), _config);
51 }
type_list< Types... > type_list_type
stack_bundle< mpl::available_t< type_list< Types... > >> bundle_type
void init(Args &&... args)
Definition: types.hpp:111

◆ lightweight_tuple() [3/9]

template<typename... Types>
template<typename... T>
tim::lightweight_tuple< Types >::lightweight_tuple ( const captured_location_t loc,
quirk::config< T... >  _config = {},
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 57 of file lightweight_tuple.cpp.

60 : bundle_type(bundle_type::handle(type_list_type{}, _loc, false_type{}, _config))
61 , m_data(invoke::construct<data_type>(_loc, _config))
62 {
63  bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func), _config);
64 }

◆ lightweight_tuple() [4/9]

template<typename... Types>
template<typename... T>
tim::lightweight_tuple< Types >::lightweight_tuple ( size_t  _hash,
quirk::config< T... >  _config = {},
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 70 of file lightweight_tuple.cpp.

72 : bundle_type(bundle_type::handle(type_list_type{}, _hash, false_type{}, _config))
73 , m_data(invoke::construct<data_type>(_hash, _config))
74 {
75  bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func), _config);
76 }

◆ lightweight_tuple() [5/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( size_t  _hash,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 81 of file lightweight_tuple.cpp.

83 : bundle_type(bundle_type::handle(type_list_type{}, _hash, false_type{}, _scope))
84 , m_data(invoke::construct<data_type>(_hash, m_scope))
85 {
86  bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func));
87 }

◆ lightweight_tuple() [6/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( const string_t key,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 92 of file lightweight_tuple.cpp.

94 : bundle_type(bundle_type::handle(type_list_type{}, _key, false_type{}, _scope))
95 {
96  bundle_type::init(type_list_type{}, *this, m_data, std::move(_init_func));
97 }

References tim::init(), and tim::lightweight_tuple< Types >::m_data.

◆ lightweight_tuple() [7/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( const captured_location_t loc,
scope::config  _scope,
transient_func_t  _init_func = get_initializer() 
)
explicit

Definition at line 102 of file lightweight_tuple.cpp.

105 : lightweight_tuple(loc.get_hash(), _scope, std::move(_init_func))
106 {}

◆ ~lightweight_tuple()

template<typename... Types>
tim::lightweight_tuple< Types >::~lightweight_tuple

Definition at line 111 of file lightweight_tuple.cpp.

112 {
113  IF_CONSTEXPR(!quirk_config<quirk::explicit_stop>::value)
114  {
115  if(m_is_active())
116  stop();
117  }
118 }
this_type & stop(Args &&...)
#define IF_CONSTEXPR(...)
Definition: language.hpp:72

References IF_CONSTEXPR, and tim::invoke::stop().

◆ lightweight_tuple() [8/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( const lightweight_tuple< Types > &  )
default

◆ lightweight_tuple() [9/9]

template<typename... Types>
tim::lightweight_tuple< Types >::lightweight_tuple ( lightweight_tuple< Types > &&  )
defaultnoexcept

Member Function Documentation

◆ assemble() [1/2]

template<typename... Types>
this_type& tim::lightweight_tuple< Types >::assemble ( )
inline

provide preliminary info to the objects with matching arguments. This is typically used to notify a component that it has been bundled alongside another component that it can extract data from.

Definition at line 224 of file lightweight_tuple.hpp.

224 { invoke::assemble(m_data, *this); }
void assemble(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:850

References tim::invoke::assemble(), and tim::lightweight_tuple< Types >::m_data.

◆ assemble() [2/2]

template<typename... Types>
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_type& tim::lightweight_tuple< Types >::assemble ( Args &&...  _args)
inline

Definition at line 227 of file lightweight_tuple.hpp.

228  {
229  invoke::assemble(m_data, std::forward<Args>(_args)...);
230  return *this;
231  }

References tim::invoke::assemble(), and tim::lightweight_tuple< Types >::m_data.

◆ audit()

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::audit ( Args &&...  _args)
inline

allow the components to inspect the incoming arguments before start or out-going return value before returning (typically using in GOTCHA components)

Definition at line 285 of file lightweight_tuple.hpp.

286  {
287  invoke::audit(m_data, std::forward<Args>(_args)...);
288  return *this;
289  }
void audit(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:921

References tim::invoke::audit(), and tim::lightweight_tuple< Types >::m_data.

◆ clone()

template<typename... Types>
lightweight_tuple< Types... > tim::lightweight_tuple< Types >::clone ( bool  store,
scope::config  _scope = scope::get_default() 
)

Definition at line 124 of file lightweight_tuple.cpp.

125 {
126  lightweight_tuple tmp(*this);
127  tmp.m_store(_store);
128  tmp.m_scope = _scope;
129  return tmp;
130 }

◆ construct()

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::construct ( Args &&...  _args)
inline

construct the objects that have constructors with matching arguments

Definition at line 212 of file lightweight_tuple.hpp.

213  {
214  using construct_t = operation_t<operation::construct>;
215  apply_v::access<construct_t>(m_data, std::forward<Args>(_args)...);
216  return *this;
217  }

References tim::lightweight_tuple< Types >::m_data.

◆ data() [1/2]

template<typename... Types>
lightweight_tuple< Types... >::data_type & tim::lightweight_tuple< Types >::data

Definition at line 315 of file lightweight_tuple.cpp.

316 {
317  return m_data;
318 }

Referenced by std::get().

◆ data() [2/2]

template<typename... Types>
const lightweight_tuple< Types... >::data_type & tim::lightweight_tuple< Types >::data

Definition at line 324 of file lightweight_tuple.cpp.

325 {
326  return m_data;
327 }

◆ derive() [1/2]

template<typename... Types>
this_type& tim::lightweight_tuple< Types >::derive ( )
inline

provide conclusive info to the objects with matching arguments. This is typically used by components to extract data from another component it has been bundled alongside, e.g. the cpu_util component can extract data from tim::component::wall_clock and tim::component::cpu_clock

Definition at line 239 of file lightweight_tuple.hpp.

239 { invoke::derive(m_data, *this); }
void derive(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:886

References tim::invoke::derive(), and tim::lightweight_tuple< Types >::m_data.

◆ derive() [2/2]

template<typename... Types>
template<typename... Args, size_t N = sizeof...(Args), enable_if_t< N !=0, int > = 0>
this_type& tim::lightweight_tuple< Types >::derive ( Args &&...  _args)
inline

Definition at line 242 of file lightweight_tuple.hpp.

243  {
244  invoke::derive(m_data, std::forward<Args>(_args)...);
245  return *this;
246  }

References tim::invoke::derive(), and tim::lightweight_tuple< Types >::m_data.

◆ execute()

template<typename... Types>
template<typename FuncT , typename... Args>
decltype(auto) tim::lightweight_tuple< Types >::execute ( FuncT &&  func,
Args &&...  args 
)
inline

when chaining together operations, this function enables executing a function inside the chain

Definition at line 202 of file lightweight_tuple.hpp.

203  {
204  return mpl::execute(*this,
205  std::forward<FuncT>(func)(std::forward<Args>(args)...));
206  }
auto execute(BundleT &&_bundle, FuncT &&_func, Args &&... _args, enable_if_t< is_invocable< FuncT, Args... >::value &&!std::is_void< std::result_of_t< FuncT(Args...)>>::value, int >)

References tim::mpl::execute().

◆ get() [1/6]

template<typename... Types>
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
T* tim::lightweight_tuple< Types >::get ( )
inline

get member functions taking either a type

Definition at line 319 of file lightweight_tuple.hpp.

320  {
321  return &(std::get<index_of<T, data_type>::value>(m_data));
322  }

References tim::lightweight_tuple< Types >::m_data.

Referenced by tim::lightweight_tuple< Types >::get().

◆ get() [2/6]

template<typename... Types>
template<typename T , enable_if_t< is_one_of< T, data_type >::value, int > = 0>
const T* tim::lightweight_tuple< Types >::get ( ) const
inline

Definition at line 325 of file lightweight_tuple.hpp.

326  {
327  return &(std::get<index_of<T, data_type>::value>(m_data));
328  }

References tim::lightweight_tuple< Types >::m_data.

◆ get() [3/6]

template<typename... Types>
template<typename T , enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
T* tim::lightweight_tuple< Types >::get ( ) const
inline

Definition at line 331 of file lightweight_tuple.hpp.

332  {
333  void* ptr = nullptr;
334  get(ptr, typeid_hash<T>());
335  return static_cast<T*>(ptr);
336  }
T * get()
get member functions taking either a type

References tim::lightweight_tuple< Types >::get().

◆ get() [4/6]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get ( Args &&...  args) const

Definition at line 250 of file lightweight_tuple.cpp.

251 {
252  return invoke::get(m_data, std::forward<Args>(args)...);
253 }
auto get(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:992

References tim::invoke::get().

◆ get() [5/6]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get ( Args &&  ...) const

◆ get() [6/6]

template<typename... Types>
this_type& tim::lightweight_tuple< Types >::get ( void *&  ptr,
size_t  _hash 
) const
inline

Definition at line 338 of file lightweight_tuple.hpp.

339  {
340  using get_t = operation_t<operation::get>;
341  apply_v::access<get_t>(m_data, ptr, _hash);
342  return const_cast<this_type&>(*this);
343  }
lightweight_tuple< Types... > this_type

References tim::lightweight_tuple< Types >::m_data.

◆ get_component()

template<typename... Types>
template<typename U , typename T = std::remove_pointer_t<decay_t<U>>, enable_if_t< trait::is_available< T >::value &&is_one_of< T, data_type >::value, int > = 0>
auto tim::lightweight_tuple< Types >::get_component ( )
inline

this is a simple alternative to get<T>() when used from SFINAE in operation namespace which has a struct get also templated. Usage there can cause error with older compilers

Definition at line 352 of file lightweight_tuple.hpp.

353  {
354  return get<T>();
355  }

◆ get_data() [1/2]

template<typename... Types>
data_type& tim::lightweight_tuple< Types >::get_data ( )
protected

◆ get_data() [2/2]

template<typename... Types>
const data_type& tim::lightweight_tuple< Types >::get_data ( ) const
protected

◆ get_initializer()

template<typename... Types>
static initializer_type& tim::lightweight_tuple< Types >::get_initializer ( )
inlinestatic

Definition at line 111 of file lightweight_tuple.hpp.

112  {
113  static initializer_type _instance = [](this_type&) {};
114  return _instance;
115  }
std::function< void(this_type &)> initializer_type

◆ get_labeled() [1/2]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get_labeled ( Args &&...  args) const

Definition at line 261 of file lightweight_tuple.cpp.

262 {
263  return invoke::get_labeled(m_data, std::forward<Args>(args)...);
264 }
auto get_labeled(TupleT< Tp... > &obj, Args &&... args)

References tim::invoke::get_labeled().

◆ get_labeled() [2/2]

template<typename... Types>
template<typename... Args>
auto tim::lightweight_tuple< Types >::get_labeled ( Args &&  ...) const

◆ get_prefix()

template<typename... Types>
auto tim::lightweight_tuple< Types >::get_prefix ( ) const
inline

Definition at line 562 of file lightweight_tuple.hpp.

562 { return bundle_type::get_prefix(); }

Referenced by tim::lightweight_tuple< Types >::print().

◆ hash()

template<typename... Types>
uint64_t tim::lightweight_tuple< Types >::hash ( ) const
inline

Definition at line 558 of file lightweight_tuple.hpp.

558 { return bundle_type::hash(); }

◆ init() [1/2]

template<typename... Types>
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&has_user_bundle_v, int > = 0>
bool tim::lightweight_tuple< Types >::init ( Args &&  ...)
inline

Definition at line 362 of file lightweight_tuple.hpp.

363  {
364  using bundle_t = decltype(std::get<0>(std::declval<user_bundle_types>()));
365  this->init<bundle_t>();
366  this->get<bundle_t>()->insert(component::factory::get_opaque<T>(m_scope),
367  component::factory::get_typeids<T>());
368  return true;
369  }

◆ init() [2/2]

template<typename... Types>
template<typename T , typename... Args, enable_if_t<!is_one_of< T, reference_type >::value &&!has_user_bundle_v, int > = 0>
bool tim::lightweight_tuple< Types >::init ( Args &&  ...)
inline

Definition at line 376 of file lightweight_tuple.hpp.

377  {
378  return is_one_of<T, reference_type>::value;
379  }

◆ init_storage()

template<typename... Types>
void tim::lightweight_tuple< Types >::init_storage
static

requests the component initialize their storage

Definition at line 364 of file lightweight_tuple.cpp.

365 {
366  static thread_local bool _once = []() {
367  apply_v::type_access<operation::init_storage, data_type>();
368  return true;
369  }();
370  consume_parameters(_once);
371 }
void consume_parameters(ArgsT &&...) TIMEMORY_HIDDEN
Definition: types.hpp:285

References tim::consume_parameters().

◆ initialize()

template<typename... Types>
template<typename... T, typename... Args>
auto tim::lightweight_tuple< Types >::initialize ( Args &&...  args)
inline

variadic initialization

Definition at line 385 of file lightweight_tuple.hpp.

386  {
387  constexpr auto N = sizeof...(T);
388  return TIMEMORY_FOLD_EXPANSION(bool, N,
389  this->init<T>(std::forward<Args>(args)...));
390  }
#define TIMEMORY_FOLD_EXPANSION(TYPE, SIZE,...)
Definition: types.hpp:63

References TIMEMORY_FOLD_EXPANSION.

◆ invoke() [1/2]

template<typename... Types>
template<template< typename > class OpT, typename... Args>
this_type& tim::lightweight_tuple< Types >::invoke ( Args &&...  _args)
inline

apply a user-defined operation to all the components

Template Parameters
OpTOperation struct

Definition at line 296 of file lightweight_tuple.hpp.

297  {
298  invoke::invoke<OpT>(m_data, std::forward<Args>(_args)...);
299  return *this;
300  }

References tim::lightweight_tuple< Types >::m_data.

◆ invoke() [2/2]

template<typename... Types>
template<template< typename > class OpT, typename... Tp, typename... Args>
this_type& tim::lightweight_tuple< Types >::invoke ( mpl::piecewise_select< Tp... >  ,
Args &&...  _args 
)
inline

generic member function for invoking user-provided operations on a specific set of component types

Template Parameters
OpTOperation struct

Definition at line 308 of file lightweight_tuple.hpp.

309  {
310  TIMEMORY_FOLD_EXPRESSION(operation::generic_operator<Tp, OpT<Tp>, TIMEMORY_API>(
311  this->get<Tp>(), std::forward<Args>(_args)...));
312  return *this;
313  }
#define TIMEMORY_FOLD_EXPRESSION(...)
Definition: types.hpp:55

References TIMEMORY_API, and TIMEMORY_FOLD_EXPRESSION.

◆ key()

template<typename... Types>
std::string tim::lightweight_tuple< Types >::key ( ) const
inline

Definition at line 557 of file lightweight_tuple.hpp.

557 { return bundle_type::key(); }

Referenced by tim::lightweight_tuple< Types >::print().

◆ laps()

template<typename... Types>
int64_t tim::lightweight_tuple< Types >::laps ( ) const
inline

Definition at line 556 of file lightweight_tuple.hpp.

556 { return bundle_type::laps(); }

◆ mark_begin()

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::mark_begin ( Args &&...  _args)
inline

mark a beginning position in the execution (typically used by asynchronous structures)

Definition at line 253 of file lightweight_tuple.hpp.

254  {
255  invoke::mark_begin(m_data, std::forward<Args>(_args)...);
256  return *this;
257  }
void mark_begin(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:474

References tim::lightweight_tuple< Types >::m_data, and tim::invoke::mark_begin().

◆ mark_end()

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::mark_end ( Args &&...  _args)
inline

mark a beginning position in the execution (typically used by asynchronous structures)

Definition at line 264 of file lightweight_tuple.hpp.

265  {
266  invoke::mark_end(m_data, std::forward<Args>(_args)...);
267  return *this;
268  }
void mark_end(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:510

References tim::lightweight_tuple< Types >::m_data, and tim::invoke::mark_end().

◆ measure() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple<Types...>& tim::lightweight_tuple< Types >::measure ( Args &&...  args)

Definition at line 174 of file lightweight_tuple.cpp.

175 {
176  invoke::measure(m_data, std::forward<Args>(args)...);
177  return *this;
178 }
void measure(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:651

References tim::invoke::measure().

◆ measure() [2/2]

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::measure ( Args &&  ...)

◆ operator*=()

template<typename... Types>
template<typename Op >
this_type& tim::lightweight_tuple< Types >::operator*= ( Op &&  rhs)
inline

Definition at line 439 of file lightweight_tuple.hpp.

440  {
441  using multiply_t = operation_t<operation::multiply>;
442  apply_v::access<multiply_t>(m_data, std::forward<Op>(rhs));
443  return *this;
444  }

References tim::lightweight_tuple< Types >::m_data.

◆ operator+=() [1/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator+= ( const this_type rhs)

Definition at line 293 of file lightweight_tuple.cpp.

294 {
295  invoke::invoke_impl::invoke_data<operation::plus, TIMEMORY_API>(m_data, rhs.m_data);
296  m_laps += rhs.m_laps;
297  return *this;
298 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator+=() [2/3]

template<typename... Types>
template<typename Op >
this_type& tim::lightweight_tuple< Types >::operator+= ( Op &&  rhs)
inline

Definition at line 431 of file lightweight_tuple.hpp.

432  {
433  using plus_t = operation_t<operation::plus>;
434  apply_v::access<plus_t>(m_data, std::forward<Op>(rhs));
435  return *this;
436  }

References tim::lightweight_tuple< Types >::m_data.

◆ operator+=() [3/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator+= ( this_type rhs)

Definition at line 304 of file lightweight_tuple.cpp.

305 {
306  invoke::invoke_impl::invoke_data<operation::plus, TIMEMORY_API>(m_data, rhs.m_data);
307  m_laps += rhs.m_laps;
308  return *this;
309 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator-=() [1/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator-= ( const this_type rhs)

Definition at line 271 of file lightweight_tuple.cpp.

272 {
273  invoke::invoke_impl::invoke_data<operation::minus, TIMEMORY_API>(m_data, rhs.m_data);
274  m_laps -= rhs.m_laps;
275  return *this;
276 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator-=() [2/3]

template<typename... Types>
template<typename Op >
this_type& tim::lightweight_tuple< Types >::operator-= ( Op &&  rhs)
inline

Definition at line 423 of file lightweight_tuple.hpp.

424  {
425  using minus_t = operation_t<operation::minus>;
426  apply_v::access<minus_t>(m_data, std::forward<Op>(rhs));
427  return *this;
428  }

References tim::lightweight_tuple< Types >::m_data.

◆ operator-=() [3/3]

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::operator-= ( this_type rhs)

Definition at line 282 of file lightweight_tuple.cpp.

283 {
284  invoke::invoke_impl::invoke_data<operation::minus, TIMEMORY_API>(m_data, rhs.m_data);
285  m_laps -= rhs.m_laps;
286  return *this;
287 }

References tim::lightweight_tuple< Types >::m_data.

◆ operator/=()

template<typename... Types>
template<typename Op >
this_type& tim::lightweight_tuple< Types >::operator/= ( Op &&  rhs)
inline

Definition at line 447 of file lightweight_tuple.hpp.

448  {
449  using divide_t = operation_t<operation::divide>;
450  apply_v::access<divide_t>(m_data, std::forward<Op>(rhs));
451  return *this;
452  }

References tim::lightweight_tuple< Types >::m_data.

◆ operator=() [1/2]

template<typename... Types>
lightweight_tuple& tim::lightweight_tuple< Types >::operator= ( const lightweight_tuple< Types > &  rhs)
default

◆ operator=() [2/2]

template<typename... Types>
lightweight_tuple& tim::lightweight_tuple< Types >::operator= ( lightweight_tuple< Types > &&  )
defaultnoexcept

◆ pop()

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::pop

Definition at line 156 of file lightweight_tuple.cpp.

157 {
158  if(m_is_pushed())
159  {
160  // set the current node to the parent node
162  // avoid pushing/popping when already pushed/popped
163  m_is_pushed(false);
164  }
165  return *this;
166 }
void pop(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:721

References tim::invoke::pop().

◆ prefix()

template<typename... Types>
auto tim::lightweight_tuple< Types >::prefix ( ) const
inline

Definition at line 561 of file lightweight_tuple.hpp.

561 { return bundle_type::prefix(); }

◆ print()

template<typename... Types>
template<bool PrintPrefix = true, bool PrintLaps = true>
this_type& tim::lightweight_tuple< Types >::print ( std::ostream &  os,
bool  skip_wo_hash = true 
) const
inline

Definition at line 486 of file lightweight_tuple.hpp.

487  {
488  using printer_t = typename bundle_type::print_type;
489  if(size() == 0)
490  return const_cast<this_type&>(*this);
491  if(m_hash == 0 && skip_wo_hash)
492  return const_cast<this_type&>(*this);
493  std::stringstream ss_data;
494  apply_v::access_with_indices<printer_t>(m_data, std::ref(ss_data), false);
495  IF_CONSTEXPR(PrintPrefix)
496  {
497  bundle_type::update_width();
498  auto _key = key();
499  if(_key.length() > 0)
500  {
501  std::stringstream ss_prefix;
502  std::stringstream ss_id;
503  ss_id << get_prefix() << " " << std::left << _key;
504  ss_prefix << std::setw(bundle_type::output_width()) << std::left
505  << ss_id.str() << " : ";
506  os << ss_prefix.str();
507  }
508  }
509  if(ss_data.str().length() > 0)
510  {
511  os << ss_data.str();
512  if(m_laps > 0 && PrintLaps)
513  os << " [laps: " << m_laps << "]";
514  }
515  return const_cast<this_type&>(*this);
516  }
static constexpr std::size_t size()
std::string key() const

References tim::lightweight_tuple< Types >::get_prefix(), IF_CONSTEXPR, tim::lightweight_tuple< Types >::key(), tim::lightweight_tuple< Types >::m_data, and tim::lightweight_tuple< Types >::size().

◆ push()

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::push

Definition at line 137 of file lightweight_tuple.cpp.

138 {
139  if(!m_is_pushed())
140  {
141  // reset the data
143  // avoid pushing/popping when already pushed/popped
144  m_is_pushed(true);
145  // insert node or find existing node
146  invoke::push(m_data, m_scope, m_hash);
147  }
148  return *this;
149 }
void push(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:686
void reset(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:581

References tim::invoke::push(), and tim::invoke::reset().

◆ record() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple<Types...>& tim::lightweight_tuple< Types >::record ( Args &&...  args)

Definition at line 224 of file lightweight_tuple.cpp.

225 {
226  ++m_laps;
227  invoke::record(m_data, std::forward<Args>(args)...);
228  return *this;
229 }
void record(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:616

References tim::invoke::record().

◆ record() [2/2]

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::record ( Args &&  ...)

◆ rekey() [1/3]

template<typename... Types>
void tim::lightweight_tuple< Types >::rekey ( const captured_location_t _loc)

Definition at line 602 of file lightweight_tuple.hpp.

603 {
604  m_hash = _loc.get_hash();
605  set_prefix(_loc.get_hash());
606 }
void set_prefix(const string_t &) const

References tim::source_location::captured::get_hash(), and tim::invoke::set_prefix().

◆ rekey() [2/3]

template<typename... Types>
void tim::lightweight_tuple< Types >::rekey ( const string_t _key)

Definition at line 592 of file lightweight_tuple.hpp.

593 {
594  m_hash = add_hash_id(_key);
595  set_prefix(_key);
596 }
hash_value_t add_hash_id(hash_map_ptr_t &_hash_map, const string_view_t &_prefix)
add an string to the given hash-map (if it doesn't already exist) and return the hash
Definition: types.hpp:187

References tim::add_hash_id(), and tim::invoke::set_prefix().

◆ rekey() [3/3]

template<typename... Types>
void tim::lightweight_tuple< Types >::rekey ( uint64_t  _hash)

Definition at line 612 of file lightweight_tuple.hpp.

613 {
614  m_hash = _hash;
615  set_prefix(_hash);
616 }

References tim::invoke::set_prefix().

◆ reset() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple<Types...>& tim::lightweight_tuple< Types >::reset ( Args &&...  args)

Definition at line 237 of file lightweight_tuple.cpp.

238 {
239  invoke::reset(m_data, std::forward<Args>(args)...);
240  m_laps = 0;
241  return *this;
242 }

References tim::invoke::reset().

◆ reset() [2/2]

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::reset ( Args &&  ...)

◆ sample() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple<Types...>& tim::lightweight_tuple< Types >::sample ( Args &&...  args)

Definition at line 186 of file lightweight_tuple.cpp.

187 {
188  invoke::invoke<operation::sample, TIMEMORY_API>(m_data, std::forward<Args>(args)...);
189  return *this;
190 }

◆ sample() [2/2]

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::sample ( Args &&  ...)

◆ serialize()

template<typename... Types>
template<typename Archive >
void tim::lightweight_tuple< Types >::serialize ( Archive &  ar,
const unsigned int   
)
inline

Definition at line 529 of file lightweight_tuple.hpp.

530  {
531  std::string _key = {};
532  auto keyitr = get_hash_ids()->find(m_hash);
533  if(keyitr != get_hash_ids()->end())
534  _key = keyitr->second;
535 
536  ar(cereal::make_nvp("hash", m_hash), cereal::make_nvp("key", _key),
537  cereal::make_nvp("laps", m_laps));
538 
539  if(keyitr == get_hash_ids()->end())
540  {
541  auto _hash = add_hash_id(_key);
542  if(_hash != m_hash)
543  {
544  PRINT_HERE("Warning! Hash for '%s' (%llu) != %llu", _key.c_str(),
545  (unsigned long long) _hash, (unsigned long long) m_hash);
546  }
547  }
548 
549  ar.setNextName("data");
550  ar.startNode();
552  ar.finishNode();
553  }
auto serialize(ArchiveT &ar, TupleT< Tp... > &obj)
hash_map_ptr_t & get_hash_ids()
tim::mpl::apply< std::string > string
Definition: macros.hpp:52
#define PRINT_HERE(...)
Definition: macros.hpp:147

References tim::add_hash_id(), tim::get_hash_ids(), tim::lightweight_tuple< Types >::m_data, PRINT_HERE, and tim::invoke::serialize().

◆ set_prefix() [1/2]

template<typename... Types>
void tim::lightweight_tuple< Types >::set_prefix ( const string_t _key) const
protected

Definition at line 333 of file lightweight_tuple.cpp.

334 {
335  invoke::set_prefix(m_data, m_hash, _key);
336 }
void set_prefix(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:756

References tim::invoke::set_prefix().

◆ set_prefix() [2/2]

template<typename... Types>
void tim::lightweight_tuple< Types >::set_prefix ( size_t  _hash) const
protected

Definition at line 342 of file lightweight_tuple.cpp.

343 {
344  auto itr = get_hash_ids()->find(_hash);
345  if(itr != get_hash_ids()->end())
346  invoke::set_prefix(m_data, _hash, itr->second);
347 }

References tim::get_hash_ids(), and tim::invoke::set_prefix().

◆ set_scope()

template<typename... Types>
lightweight_tuple< Types... > & tim::lightweight_tuple< Types >::set_scope ( scope::config  val)

Definition at line 353 of file lightweight_tuple.cpp.

354 {
355  m_scope = val;
356  invoke::set_scope(m_data, m_scope);
357  return *this;
358 }
void set_scope(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:792

References tim::invoke::set_scope().

◆ size()

template<typename... Types>
static constexpr std::size_t tim::lightweight_tuple< Types >::size ( )
inlinestaticconstexpr

Definition at line 161 of file lightweight_tuple.hpp.

161 { return std::tuple_size<tuple_type>::value; }

Referenced by tim::lightweight_tuple< Types >::print().

◆ start() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple<Types...>& tim::lightweight_tuple< Types >::start ( Args &&...  args)

Definition at line 198 of file lightweight_tuple.cpp.

199 {
200  invoke::start(m_data, std::forward<Args>(args)...);
201  m_is_active(true);
202  return *this;
203 }
void start(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:298

References tim::invoke::start().

◆ start() [2/2]

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::start ( Args &&  ...)

◆ stop() [1/2]

template<typename... Types>
template<typename... Args>
lightweight_tuple<Types...>& tim::lightweight_tuple< Types >::stop ( Args &&...  args)

Definition at line 210 of file lightweight_tuple.cpp.

211 {
212  invoke::stop(m_data, std::forward<Args>(args)...);
213  ++m_laps;
214  m_is_active(false);
215  return *this;
216 }
void stop(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:368

References tim::invoke::stop().

◆ stop() [2/2]

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::stop ( Args &&  ...)

◆ store() [1/3]

template<typename... Types>
bool& tim::lightweight_tuple< Types >::store ( )
inline

Definition at line 559 of file lightweight_tuple.hpp.

559 { return bundle_type::store(); }
void store(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:546

References tim::invoke::store().

◆ store() [2/3]

template<typename... Types>
const bool& tim::lightweight_tuple< Types >::store ( ) const
inline

Definition at line 560 of file lightweight_tuple.hpp.

560 { return bundle_type::store(); }

References tim::invoke::store().

◆ store() [3/3]

template<typename... Types>
template<typename... Args>
this_type& tim::lightweight_tuple< Types >::store ( Args &&...  _args)
inline

store a value

Definition at line 274 of file lightweight_tuple.hpp.

275  {
276  invoke::store(m_data, std::forward<Args>(_args)...);
277  return *this;
278  }

References tim::lightweight_tuple< Types >::m_data, and tim::invoke::store().

◆ type_apply() [1/2]

template<typename... Types>
template<typename T , typename Func , typename... Args, enable_if_t<!is_one_of< T, data_type >::value, int > = 0>
this_type& tim::lightweight_tuple< Types >::type_apply ( Func &&  ,
Args &&  ... 
)
inline

Definition at line 406 of file lightweight_tuple.hpp.

407  {
408  return *this;
409  }

◆ type_apply() [2/2]

template<typename... Types>
template<typename T , typename Func , typename... Args, enable_if_t< is_one_of< T, data_type >::value, int > = 0>
this_type& tim::lightweight_tuple< Types >::type_apply ( Func &&  _func,
Args &&...  _args 
)
inline

apply a member function to a type that is in variadic list AND is available

Definition at line 397 of file lightweight_tuple.hpp.

398  {
399  auto&& _obj = get<T>();
400  ((_obj).*(_func))(std::forward<Args>(_args)...);
401  return *this;
402  }

Friends And Related Function Documentation

◆ impl::base_bundle

template<typename... Types>
template<typename... Tp>
friend class impl::base_bundle
friend

Definition at line 77 of file lightweight_tuple.hpp.

◆ operator*

template<typename... Types>
template<typename Op >
this_type operator* ( const this_type lhs,
Op &&  rhs 
)
friend

Definition at line 470 of file lightweight_tuple.hpp.

471  {
472  this_type tmp(lhs);
473  return tmp *= std::forward<Op>(rhs);
474  }

◆ operator+

template<typename... Types>
this_type operator+ ( const this_type lhs,
const this_type rhs 
)
friend

Definition at line 457 of file lightweight_tuple.hpp.

458  {
459  this_type tmp(lhs);
460  return tmp += rhs;
461  }

◆ operator-

template<typename... Types>
this_type operator- ( const this_type lhs,
const this_type rhs 
)
friend

Definition at line 463 of file lightweight_tuple.hpp.

464  {
465  this_type tmp(lhs);
466  return tmp -= rhs;
467  }

◆ operator/

template<typename... Types>
template<typename Op >
this_type operator/ ( const this_type lhs,
Op &&  rhs 
)
friend

Definition at line 477 of file lightweight_tuple.hpp.

478  {
479  this_type tmp(lhs);
480  return tmp /= std::forward<Op>(rhs);
481  }

◆ operator<<

template<typename... Types>
std::ostream& operator<< ( std::ostream &  os,
const this_type obj 
)
friend

Definition at line 520 of file lightweight_tuple.hpp.

521  {
522  obj.print<true, true>(os);
523  return os;
524  }

Member Data Documentation

◆ has_gotcha_v

template<typename... Types>
constexpr bool tim::lightweight_tuple< Types >::has_gotcha_v = bundle_type::has_gotcha_v
staticconstexpr

Definition at line 107 of file lightweight_tuple.hpp.

◆ has_user_bundle_v

template<typename... Types>
constexpr bool tim::lightweight_tuple< Types >::has_user_bundle_v = bundle_type::has_user_bundle_v
staticconstexpr

Definition at line 108 of file lightweight_tuple.hpp.

◆ m_data


The documentation for this class was generated from the following files: