This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Weird (unintuitive?) behavior of std::tuple
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Alex Dubov <oakad at yahoo dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 29 Oct 2010 21:04:24 +0200
- Subject: Re: Weird (unintuitive?) behavior of std::tuple
- References: <loom.20101029T194502-571@post.gmane.org>
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.