Boost C++ Libraries: Ticket #443: no Boolean conversion for boost::rational https://svn.boost.org/trac10/ticket/443 <pre class="wiki">The boost::rational class template, in header file &lt;boost/ rational.hpp&gt;, 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. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/443 Trac 1.4.3 Daryle Walker Tue, 27 Dec 2005 12:08:45 GMT status changed https://svn.boost.org/trac10/ticket/443#comment:1 https://svn.boost.org/trac10/ticket/443#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=551024 I just submitted a fix; please re-open this bug if the fix doesn't work. The CVS versions for each file in the fix are: BOOST_ROOT/boost/rational.hpp :1.16 BOOST_ROOT/libs/rational/rational.html :1.7 BOOST_ROOT/libs/rational/rational_test.cpp :1.18 </pre> Ticket