please help me read the following meta looper
- User
please help me read the following meta looper system: /A meta obj is a bind of a meta_function and an obj, each time it is invoked, it update itself to a new type, use ::type to get the inner obj/ template<class MMO(Obj), class F/Define how to Update an obj/> struct meta_object { using type = MMO(Obj); template<class ...Arg> using apply = meta_object<meta_invoke<F, MMO(Obj), Arg...>, F>;
template<class Outer_Obj> using meta_set = meta_object<Outer_Obj, F>;};
template<class MMO(Obj), class F, class Ret> struct meta_ret_object { using ret = meta_invoke<Ret, MMO(Obj)>; using type = MMO(Obj); template<class ...Arg> using apply = meta_ret_object<meta_invoke<F, MMO(Obj), Arg...>, F, Ret>;
template<class Outer_Obj> using meta_set = meta_ret_object<Outer_Obj, F, Ret>;};
template<size_t times, class MMO(Obj), class F, class break_f = meta_always_continue> struct meta_timer_object { using timer = meta_invoke<meta_break_if<break_f, quick_value_i_greater<times, 0>>, MMO(Obj)>;
using type = MMO(Obj); template<class ...Arg> using apply = meta_timer_object<times - 1, meta_invoke<F, MMO(Obj), Arg...>, F, break_f>; template<class Outer_Obj> using meta_set = meta_timer_object<times, Outer_Obj, F, break_f>; template<size_t reset_time> using reset = meta_timer_object<reset_time, MMO(Obj), F, break_f>;};
template<class MMO(Obj), size_t N, class break_f> struct To_Timer {}; template<class obj, class F, size_t N, class break_f> struct To_Timer<meta_object<obj, F>, N, break_f> { using type = meta_timer_object<N, obj, F, break_f>; };
template<class MMO(Obj), size_t N, class break_f = meta_always_continue> using to_timer = typename To_Timer<MMO(Obj), N, break_f>::type;
template<class mo, class F> struct Break_If {}; template<size_t N, class MMO(Obj), class MO_F, class F> struct Break_If<meta_timer_object<N, MMO(Obj), MO_F>, F> { using type = meta_timer_object<N, MMO(Obj), MO_F, F>; };
template<class MTO, class BF> using break_if = get_type<Break_If<MTO, BF>>;
template<class MMO(From), class MMO(To)> struct meta_transfer { using type = typename MMO(To)::template meta_set<typename MMO(From)::type>; };
//transfer timer if invoke to a meta_timer_oject template<size_t times, class obj, class F, class MMO(To), class B> struct meta_transfer<meta_timer_object<times, obj, F, B>, MMO(To)> { using type = typename MMO(To)::template meta_set<typename meta_timer_object<times, obj, F, B>::timer>; };
//transfer returns if invoke to a meta_ret_object template<class Ret, class obj, class F, class MMO(To)> struct meta_transfer<meta_ret_object<obj, F, Ret>, MMO(To)> { using type = typename MMO(To)::template meta_set<typename meta_ret_object<obj, F, Ret>::ret>; };
//the meta_object is itself a meta_function //if two meta_objects invoked, invoke the first object with type in second object template<class MMO(Obj1), class MMO(Obj2)> struct Meta_Object_Invoke { using type = meta_invoke< MMO(Obj1), typename MMO(Obj2)::type>; };
- Assistant
- User
- Assistant
- User
how does the container work? is it like a link list but able to store different types of data?
- Assistant
- User
- Assistant