I have a tuple of unknown size (it\'s template parametr of method)
Is it way to get part of it (I need throw away first element of it)
For example, I have
There may be an easier way, but this is a start. The "tail" function template returns a copied tuple with all values of the original except the first. This compiles with GCC 4.6.2 in C++0x-mode.
template
struct assign {
template
static void x(ResultTuple& t, const SrcTuple& tup) {
std::get(t) = std::get(tup);
assign::x(t, tup);
}
};
template<>
struct assign<1> {
template
static void x(ResultTuple& t, const SrcTuple& tup) {
std::get<0>(t) = std::get<1>(tup);
}
};
template struct tail_helper;
template
struct tail_helper> {
typedef typename std::tuple type;
static type tail(const std::tuple& tup) {
type t;
assign::value>::x(t, tup);
return t;
}
};
template
typename tail_helper::type tail(const Tup& tup) {
return tail_helper::tail(tup);
}