I have a question about dividing a tuple, as the title said.
In fact, I can do it using std::index_sequence
, but the code looks ugly.
Is there an elegant way of accomplishing this?
Here are some code to show what I mean.
#include<tuple>
using namespace std;
template<typename THead, typename ...TTails>
void foo(tuple<THead, TTails...> tpl)
{
tuple<THead> tpl_h { get<0>(tpl) };
tuple<TTails...> tpl_t { /* an elegent way? */ }
do_sth(tpl_h, tpl_t);
}
int main()
{
foo(make_tuple(1, 2.0f, 'c'));
return 0;
}