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

 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.

I think you're right, I edited the comment to talk about temporaries and full expressions (and also lowered it to the Notes section) --Cubbi (talk) 10:23, 29 March 2015 (PDT)