Boost C++ Libraries: Ticket #1489: BOOST_CHECK_CLOSE fails to compile with templated value type https://svn.boost.org/trac10/ticket/1489 <p> I was wanting to check two boost::numeric::interval's for closeness, but find I get a compile error. The below fails to compile, with the error messages shown. I believe this is because </p> <blockquote> <p> i) the comparison operator for interval is templated, </p> </blockquote> <blockquote> <p> ii) boost.test wraps one of the values with a readonly_property </p> </blockquote> <p> and therefore the template is not an exact match. Changing the tolerance to an interval does not change anything. This is with MSVC8 and with gcc 3.4.4 on windows. Is this a bug, a missing feature - or am I misusing BOOST_CHECK_CLOSE ? </p> <p> c:\cygwin\home\duncan\boost\boost/test/floating_point_comparison.hpp(184) : error C2679: binary '&lt;=' : no operator found which takes a right-hand operand of type 'const boost::unit_test::readonly_property&lt;<a class="missing wiki">PropertyType</a>&gt;' (or there is no acceptable conversion) </p> <blockquote> <p> with [ </p> <blockquote> <p> <a class="missing wiki">PropertyType</a>=boost::numeric::interval&lt;double&gt; </p> </blockquote> <p> ] c:\cygwin\home\duncan\boost\boost/numeric/interval/interval.hpp(82): </p> </blockquote> <p> could be 'bool boost::numeric::interval&lt;T&gt;::operator &lt;=(const boost::numeric::interval&lt;T&gt;::interval_holder &amp;) const' </p> <blockquote> <p> with [ </p> <blockquote> <p> T=double </p> </blockquote> <p> ] c:\cygwin\home\duncan\boost\boost/numeric/interval/interval.hpp(89): </p> </blockquote> <p> or 'bool boost::numeric::interval&lt;T&gt;::operator &lt;=(const boost::numeric::interval&lt;T&gt;::number_holder &amp;) const' </p> <blockquote> <p> with [ </p> <blockquote> <p> T=double </p> </blockquote> <p> ] while trying to match the argument list </p> </blockquote> <p> '(boost::numeric::interval&lt;T&gt;, const boost::unit_test::readonly_property&lt;<a class="missing wiki">PropertyType</a>&gt;)' </p> <blockquote> <p> with [ </p> <blockquote> <p> T=double </p> </blockquote> <p> ] and [ </p> <blockquote> <p> <a class="missing wiki">PropertyType</a>=boost::numeric::interval&lt;double&gt; </p> </blockquote> <p> ] </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1489 Trac 1.4.3 Hugo Duncan <hugo_duncan@…> Fri, 30 Nov 2007 21:13:22 GMT attachment set https://svn.boost.org/trac10/ticket/1489 https://svn.boost.org/trac10/ticket/1489 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_interval_check.cpp</span> </li> </ul> <p> Test case </p> Ticket Gennadiy Rozental Mon, 21 Jan 2008 17:29:02 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1489#comment:1 https://svn.boost.org/trac10/ticket/1489#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> Works for me using msvc 8.0 msvc 7.1 and gcc on cygwin </p> Ticket