Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-10 17:20:23


Rob Stewart wrote:
> From: "Jonathan Turkanis" <technews_at_[hidden]>
>> Rob Stewart wrote:
>>
>>> The
>>> unfortunate thing is that this scheme makes basic_character far
>>> more complicated,
>>
>> Yes, I was hoping to limit the interface to a single conversion
>> operator. I'd hate to see someone just learning the library look up
>> get() in the reference section, click on the return type and be
>> confronted with a monstrous synopsis. Could I present a "fictional"
>> synopsis of basic_character, which doesn't show all the overloads,
>> and include a note explaining the problem?
>
> What's fictional?. The operators to which you refer would not be
> implemented as members,

They might be friends implemented in-class.

> so you can add a section like this to the
> basic_character interface section:
>
> For numeric and character comparisions, basic_character also
> has the following operators available, where OP is ==, !=, >,
> <, >=, and <=:
>
> template <typename Ch>
> bool operator OP(basic_character<Ch>, Ch);
>
> template <typename Ch>
> bool operator OP(basic_character<Ch>, int);
>
> template <typename Ch>
> bool operator OP(Ch, basic_character<Ch>);
>
> template <typename Ch>
> bool operator OP(int, basic_character<Ch>);

That's pretty good -- I like "Op". I also need overloads for + and -, which
should return basic_character, I think. And +=/-=.

Jonathan


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