Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-04-27 15:35:04


Felipe Magno de Almeida <felipe.m.almeida_at_[hidden]> writes:

>> Is there any amount of feedback from potential users that would
>> impress you? So far a number of people in this thread have noted that
>> the interface seems unduly restrictive. Have you heard from anyone
>> who said "thank you, Thorsten, for preventing me from unintentionally
>> doing something expensive?" Can you imagine it hapenning? For my
>> part, this design detail and the associated response to feedback would
>> prevent me from using the library altogether. I'd rather roll my own,
>> should I need such a thing.
>>
>
> I needed to use a std::map<something, std::set<ExpensiveClass> >, at
> first I saw it as:
> std::map<something, boost::ptr_set<ExpensiveClass> >, and certainly it
> wasnt the way to do it... I just didnt do it because I saw it couldnt
> be done... correcting it to:
> boost::ptr_map<something, boost::ptr_set<ExpensiveClass> >
> So, well... I think it isnt that bad that it uses another syntax to
> make copies of ptr_containers...
> And I'm using ptr_containers all that time now...

The question isn't "were you able to work around it in this one case,"
but "was it helpful to have been prevented from writing it the natural
way?"

Note that the library doesn't provide workarounds when the outer thing
isn't a standard container. Try

  std::vector<std::pair<int, boost::ptr_set<ExpensiveClass> >

instead.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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