|
Boost : |
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2000-08-21 16:52:57
Jens Maurer wrote:
>
> Here are my review comments as a boost member. Please don't
> confuse this with my role as review manager.
I've got another point:
I don't like the "sub_match" class.
First, the documentation doesn't state what happens if
matched == false and one of the conversion functions or length()
is called.
Second, the class has many implicit conversion operators.
All textbooks explain that one should be wary of implicit
conversion operators.
I may accept the conversion to std::string, since a sub-match
is simply a (sub-) string.
However, the conversions to int, unsigned int, short, unsigned short
look strange. As mentioned above, a sub-match is simply a string,
so it is the duty of the caller to interpret whatever semantics
he wishes into that string, including interpreting it as a number.
Additionally, the conversion to long and unsigned long is missing
anyway. Oh, and while we're at it, a conversion to double
would be nice, too. :-)
You cannot compare a std::string with an int, so it seems natural
and consistent not to be able to compare a sub_match with an int.
In short, I think the simple concept of sub_match<> is blown up
too much in the implementation and the implicit conversion operators
should be removed.
Jens Maurer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk