c++ - How to make std::get to be member method(s)? -


std::get link gets elements of tuple. overloaded function has number of versions. if have class derived tuple, , want introduce member method get() tuple elements using std::get. need write member method each version of std::get or can write one?

template<class... args> class data     : public std::tuple<args...> { public:     typedef std::tuple<args...> tuplety;      // 1 version.     template<unsigned n>     (typename std::tuple_element<n, tuplety>::type)& get()     {         return std::get<n>(*this);     } }; 


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -