Boost logo

Boost :

Subject: Re: [boost] Proposal: Linear map
From: Amir Ansari (amir.ansari80_at_[hidden])
Date: 2012-07-18 11:39:16


OK. Fair enough. But I was thinking if flat_set could be configured so that the underlying container (vector/ptr_vector) could be changed, that would be awesome. Anyway, that was just my thoughts. Many thanks for your patience and very clear answers.

 

________________________________
 From: Andrey Semashev <andrey.semashev_at_[hidden]>
To: boost_at_[hidden]
Sent: Wednesday, July 18, 2012 8:12 PM
Subject: Re: [boost] Proposal: Linear map
  
On Wednesday 18 July 2012 08:01:09 Amir Ansari wrote:
> >> 2. Is there some specialization for flat_set with the same semantics as
> >> ptr_vector ?
> >
> >I'm not sure I understand. Do you intend to store pointers in flat_set? If
> >so, you can store std::unique_ptr's or shared_ptr's and specify your
> >custom ordering predicate to order pointers by their pointees.
>
> The documentation for boost::ptr_vector says that using the smart pointers
> inside a vector isn't ideal... it's one of the reasons why ptr_vector
> exists. I was wondering if that logic applies still when flat_set holds
> pointers and is there a solution available?

If you have unique_ptr, standard containers can hold exclusive pointers, which
practically defeats the efficiency penalty of storing shared_ptr's. Pointer
containers also provide other features but if all you need is store pointers
in containers, unique_ptr and STL containers are enough. The same applies to
flat_set.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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