#ifndef __cxz_dynamic_meta_h__ #define __cxz_dynamic_meta_h__ #include #include #include "allocator.h" namespace CNORXZ { typedef std::pair DynamicMetaElem; template struct DynamicMetaSetter { template static inline void set(const std::tuple& in, vector& meta) { typedef typename std::tuple_element>::type elemtype; meta[N].first = reinterpret_cast( &std::get(in) ); meta[N].second = sizeof(elemtype); DynamicMetaSetter::set(in,meta); } }; template <> struct DynamicMetaSetter<0> { template static inline void set(const std::tuple& in, vector& meta) { typedef typename std::tuple_element<0,std::tuple>::type elemtype; meta[0].first = reinterpret_cast( &std::get<0>(in) ); meta[0].second = sizeof(elemtype); } }; class DynamicMetaT { private: vector mMeta; public: DynamicMetaT() = default; DynamicMetaT(const DynamicMetaT& in) = default; DynamicMetaT(DynamicMetaT&& in) = default; DynamicMetaT& operator=(const DynamicMetaT& in) = default; DynamicMetaT& operator=(DynamicMetaT&& in) = default; template DynamicMetaT(const std::tuple* meta) : mMeta(sizeof...(Us)) { DynamicMetaSetter::set(*meta,mMeta); } bool operator==(const DynamicMetaT& in) const; bool operator!=(const DynamicMetaT& in) const; size_t size() const; DynamicMetaElem& operator[](size_t pos); const DynamicMetaElem& operator[](size_t pos) const; }; } // namespace CNORXZ #endif