Talk:cpp/utility/tuple/forward as tuple
The code given in the example "
m.emplace(10, 20, 'a');" does not work with libc++ (llvm, svn from 130827) and libstdc++ (gnu, 4.8.1) while the other line from the example "
m.emplace(std::forward_as_tuple(10, std::string(20, 'a')));" fails only for libstdc++. The following would work
m.emplace ( std::piecewise_construct, std::forward_as_tuple(10), std::forward_as_tuple(20, 'a') );
Schirmer 00:00, 29 August 2013 (PDT)
- Yes, the comment in the example is wrong, thank you for spotting it. --Cubbi 03:22, 29 August 2013 (PDT)
"If rvalues are used, the result of this function must be consumed before the next sequence point"
a) They don't have to be consumed at all, and b) shouldn't this critereon be "before the end of the current full expression", assuming we're talking about the lifetime of temporary objects?
As currently stated, the object returned from forward_as_tuple would be impossible to use as a function argument because there's a sequence point between argument evaluation and entering the function.