Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: auto_ptr not behaving as per header comment



On Tue, 9 Aug 2005 18:56:24 -0700 Steve Checkoway <email@hidden> wrote:

struct foo { };
struct bar : public foo { };

std::auto_ptr<bar> get_bar() { return std::auto_ptr<bar>(new bar); }

int main()
{
        std::auto_ptr<foo> ptr = get_bar();
        return 0;
}

This code looks intuitively correct, so it *should* be OK, in general sense. A closely related issue in the C++ standard is described here: <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#463> (may even be exactly the same, I'm not sure). When corrections to the standard introduce such severe regressions, I don't know who is to blame.


CodeWarrior compiles this just fine (why am I not surprised?), but still doesn't compile other intuitively correct code (grrrr...):

void use_foo(std::auto_ptr<foo>);

std::auto_ptr<bar> aBar;
use_foo(aBar);

I'd expect this issue to have been extensively discussed, filed in the gcc bugzilla etc - I just haven't researched it a lot. Of Apple mail lists, xcode-users appears the most relevant.

- WBR, Alexey Proskuryakov
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >auto_ptr not behaving as per header comment (From: Steve Checkoway <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.