Opened 15 years ago
Closed 15 years ago
#1489 closed Bugs (worksforme)
BOOST_CHECK_CLOSE fails to compile with templated value type
Reported by: | Owned by: | Gennadiy Rozental | |
---|---|---|---|
Milestone: | To Be Determined | Component: | test |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
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
i) the comparison operator for interval is templated,
ii) boost.test wraps one of the values with a readonly_property
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 ?
c:\cygwin\home\duncan\boost\boost/test/floating_point_comparison.hpp(184) : error C2679: binary '<=' : no operator found which takes a right-hand operand of type 'const boost::unit_test::readonly_property<PropertyType>' (or there is no acceptable conversion)
with [
PropertyType=boost::numeric::interval<double>
] c:\cygwin\home\duncan\boost\boost/numeric/interval/interval.hpp(82):
could be 'bool boost::numeric::interval<T>::operator <=(const boost::numeric::interval<T>::interval_holder &) const'
with [
T=double
] c:\cygwin\home\duncan\boost\boost/numeric/interval/interval.hpp(89):
or 'bool boost::numeric::interval<T>::operator <=(const boost::numeric::interval<T>::number_holder &) const'
with [
T=double
] while trying to match the argument list
'(boost::numeric::interval<T>, const boost::unit_test::readonly_property<PropertyType>)'
with [
T=double
] and [
PropertyType=boost::numeric::interval<double>
]
Attachments (1)
Change History (2)
by , 15 years ago
Attachment: | boost_interval_check.cpp added |
---|
comment:1 by , 15 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Works for me using msvc 8.0 msvc 7.1 and gcc on cygwin
Test case