Boost logo

Boost :

From: Vugts, Robert (robert.vugts_at_[hidden])
Date: 2000-12-21 05:33:59


What is the release method supposed to do when the use-count > 1 ?

        -Rob-

-----Original Message-----
From: Gary Powell [mailto:Gary.Powell_at_[hidden]]
Sent: 20 December 2000 16:02
To: 'boost_at_[hidden]'
Subject: RE: [boost] Suggestion: scoped_ptr::release()

> I think the scoped_ptr class should have a release() function, similar
> to the one in std::auto_ptr. This would help in cases like the following
>
>
Seems reasonable to me. (I have to code in a C/C++ environment where
returning a C pointer is required by the called API.)

Would a better example be:
  void foo(std::list<data *> &myList, int x)
  {
       shared_ptr<data> theData(new data(x) );
       myList.push_back(theData.get() );
       theData.release();
  }

(I know it could be improved by having a list of shared_ptrs, but sometimes
that change isn't possible due to who controls the code. Third party
software etc. )

  -gary-

gary.powell_at_[hidden]

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and all
copies of it from your system, destroy any hard copies of it and notify the
sender. You must not, directly or indirectly, use, disclose, distribute,
print, or copy any part of this message if you are not the intended
recipient. CREDIT SUISSE GROUP and each of its subsidiaries each reserve
the right to monitor all e-mail communications through its networks. Any
views expressed in this message are those of the individual sender, except
where the message states otherwise and the sender is authorised to state
them to be the views of any such entity.
Unless otherwise stated, any pricing information given in this message is
indicative only, is subject to change and does not constitute an offer to
deal at any price quoted.
Any reference to the terms of executed transactions should be treated as
preliminary only and subject to our formal written confirmation.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk