Joaquín Mª López Muñoz wrote:
> 1. Syntax and semantics
> Since bimap follows as closely as possible the interface of std::map,
> there's little IMHO to add or remove from here. The added constraint
> of bidirectionality imposes some behavior that diverges from regular
> maps, though. I don't think there's an alternate way to handle the
> following
> issues:
> * operator[], when used for inspection on a non-existent value, throws
> bimap_base::value_not_found. std::maps, on the other hand, automatically
> 
> insert a default value. This I cannot do in bimap, since it would
> violate
> the bidirectionality.


What about when operator[] is used for an assignment to a unique value?
I have to imagine that there are scenarios where inserting a temporary
value wouldn't be all that bad.  Is it possible to make this a policy of
some kind?  

Or possibly an template parameter to a "default value" generator
function?  The template parameter could default to a function that
throws the exception...


> * bimap_base::duplicate_value is thrown whenever an assignment is
> attempted to a value already present in the bimap: this again stems from
> 
> the preservation of the bidirectionality invariant.

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

Reply via email to