I have a pressing need for the function std::forward_as_tuple
, but am restricted to using GCC 4.5.0 (I know this is a bad situation to put oneself into, but it would solve a lot of problems for me, so please keep the snarky remarks to a minimum). The <tuple>
header does not seem to contain the function (as it should), so my question is:
Implementation is simple:
template <typename... Elements>
/*constexpr*/ tuple<Elements&&...>
forward_as_tuple(Elements&&... args) /* noexcept */
{
return tuple<Elements&&...>(std::forward<Elements>(args)...);
}
Don't know in which GCC it appears. According this document variadic templates and rvalue refs are available since gcc 4.3, so it should work for your gcc 4.5 (I hope)