Namespaces
Variants
Views
Actions

Talk:cpp/utility/tuple/forward as tuple

From cppreference.com

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)