This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Weird (unintuitive?) behavior of std::tuple


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]