|
Boost : |
From: Matias Capeletto (matias.capeletto_at_[hidden])
Date: 2006-08-10 12:22:53
On 8/10/06, David Walthall <walthall_at_[hidden]> wrote:
> Matias Capeletto wrote:
> > * In relation with Boost.MultiIndex, Do you think that it is
> > worth to have a bidirectional map library in Boost, that trades
> > generality for a better specialized user interface?
>
> Absolutely.
Great!
> > * What do you think of the design of operator[]?
> > Is there a better way to be coherent with the stl that does not imply
> > throwing exceptions?
>
> Have you considered making this behavior a policy? There may be
> situations where a user would prefer that their bimap do something
> different, such as asserting (in debug mode), or ignoring the insertion
> request altogether.
> An even more exotic approach to handling the collision could be to erase
> the old elements. That is, when (a,b) is inserted, the policy could
> specify that (a,*) and (*,b) are erased from the set before (a,b) is
> inserted.
Yes, I have discussed a policy approach with my mentor. In fact, the first
implementation of operator[] was to ignore the insertion is something goes
wrong. I like the idea of a policy to control this behavior but I have to
find a way to maintain the bimap template parameters as simple as they
are today. The problem now is to determine if throwing exceptions is the
better default behaviour. The policy approach can be implemented as a
future feature maintaining backward compatibility.
Regards
Matias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk