|
Boost : |
From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-04-05 18:49:40
>>
> is a valid sequence. See http://www.gotw.ca/gotw/056.htm .
<<
Ok, I now have a "need" for auto_ptr_new as described by the above.
Specifically I have
std::pair<boost::any, boost::any>
and in this particular case I have a pair of shared_ptr<string>'s, as a
member of my class. And as I was trying to write the constructor, I realized
that
my_any_pair(shared_ptr<string>(auto_ptr<string>(new string("text") ),
auto_ptr<string>(new string("text2") );
where I don't really want to have default construction, and then do the
assignment the "safe" way.
So the issue brought up by gotw/056 isn't as weird a case as I had first
imagined, or am I being overly cautious here?
-gary-
gary.powell_at_[hidden]
PS
"need" as in I'm shooting for exception safe code, but I realize that the
project as a whole has a long way to go. I also may have made a bad design
choice a week ago and this "need" may go away. But for now, an auto_ptr_new
would be just the ticket.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk