Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-03-26 14:16:59


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:003501c41363$d23fe7b0$1d00a8c0_at_pdimov2...
> Jonathan Turkanis wrote:
> >
> > This is probably the best characterization of the traits/policy
> > distinction I've heard. I don't agree entirely about basic_string,
> > however; I think that the comparison functions such as
> > char_traits::compare have to be made available through template
> > parameters, otherwise you wouldn't be able to reuse basic_string
if
> > you want strings with different comparison criteria.
>
> I thought it was already common knowledge that the idea of using the
> 'char_traits' policy parameter of basic_string to override
comparisons is
> inherently flawed. Usually the kind of comparison you want depends
on the
> context where the string is used, not on the type of the string.

Yes, I know this argument, and in fact I have always used a comparison
predicate when I need to customize string comparisons.

However, if you accept that comparisons criteria are alway contextual,
I think you must conclude that the comparison operators <, <=, etc.
are completely useless. On the contrary, I like the ability to have a
default comparison criteria that works a good deal of the time; as
long as it's provided, it should be customizable.

Jonathan


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