Opened 17 years ago
Closed 17 years ago
#443 closed Bugs (Fixed)
no Boolean conversion for boost::rational
Reported by: | Daryle Walker | Owned by: | Jonathan Turkanis |
---|---|---|---|
Milestone: | Component: | None | |
Version: | None | Severity: | |
Keywords: | Cc: |
Description
The boost::rational class template, in header file <boost/ rational.hpp>, does not support conversion to a Boolean value. It does have an "operator !" defined, though. It is a surprise for a type to have one of these operations but not the other. Currently code like "if ( !r )" works but not "if ( r )", which should be expected. A solution is to add a conversion operator to a type that can be used in Boolean contexts, but as little else as possible. A suggestion is to use a pointer-to-member (to data or function) type that is unique to each version of boost::rational, where the exact values are private.
Note:
See TracTickets
for help on using tickets.