Weird (unintuitive?) behavior of std::tuple
Paolo Carlini
paolo.carlini@oracle.com
Fri Oct 29 19:04:00 GMT 2010
On 10/29/2010 08:10 PM, Alex Dubov wrote:
> In the primitive example, attached below, constructors for B and C will be
> invoked exactly once, yet destructors - twice (this, of course, causes a crash in more complex setting).
>
What happens if you use the much simpler std::pair instead? And what
happens, in particular, if you do this:
pair<int, int> yy(int(), int());
printf("%d", yy.first);
Food for thought... ;)
Paolo.
More information about the Libstdc++
mailing list