Boost logo

Boost :

Subject: [boost] [ICL] Compile error when using "is_numeric"
From: sguazt (marco.guazzone_at_[hidden])
Date: 2011-05-26 06:24:42


Hi,

I've just checked-out the last SVN version of ICL and after compiling with
  gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
  (flags: -Wall -Wextra -pedantic -ansi)

I get these errors:

--- [error] ---
boost-trunk/boost/icl/concept/interval_bounds.hpp:89:58: error:
type/value mismatch at argument 2 in template parameter list for
‘template<class Type, class Compare, bool Enable> struct
boost::icl::numeric_minimum’
boost-trunk/boost/icl/concept/interval_bounds.hpp:89:58: error:
expected a type, got ‘boost::icl::is_numeric<Type>::value’
...
boost-trunk/boost/icl/concept/interval_bounds.hpp:104:58: error:
type/value mismatch at argument 2 in template parameter list for
‘template<class Type, class Compare, bool Enable> struct
boost::icl::numeric_minimum’
boost-trunk/boost/icl/concept/interval_bounds.hpp:104:58: error:
expected a type, got ‘boost::icl::is_numeric<Type>::value’
...
boost-trunk/boost/icl/left_open_interval.hpp:52:64: error: type/value
mismatch at argument 2 in template parameter list for ‘template<class
Type, class Compare, bool Enable> struct boost::icl::numeric_minimum’
boost-trunk/boost/icl/left_open_interval.hpp:52:64: error: expected
a type, got ‘boost::icl::is_numeric<Type>::value’
...
boost-trunk/boost/icl/open_interval.hpp:51:64: error: type/value
mismatch at argument 2 in template parameter list for ‘template<class
Type, class Compare, bool Enable> struct boost::icl::numeric_minimum’
boost-trunk/boost/icl/open_interval.hpp:51:64: error: expected a
type, got ‘boost::icl::is_numeric<Type>::value’
--- [/error] ---

To solve this problem, it seems it is sufficient to prefix the use of
"is_numeric" with "typename".
Here below is the diff file:
--- [diff] ---
Index: boost/icl/left_open_interval.hpp
===================================================================
--- boost/icl/left_open_interval.hpp (revision 72177)
+++ boost/icl/left_open_interval.hpp (working copy)
@@ -49,7 +49,7 @@
         // Only for discrete types this ctor creates an interval containing
         // a single element only.
         BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value));
- BOOST_ASSERT((numeric_minimum<DomainT,
is_numeric<DomainT>::value >::is_less_than(val) ));
+ BOOST_ASSERT((numeric_minimum<DomainT, typename
is_numeric<DomainT>::value >::is_less_than(val) ));
     }

     /** Interval from <tt>low</tt> to <tt>up</tt> with bounds
<tt>bounds</tt> */
Index: boost/icl/concept/interval_bounds.hpp
===================================================================
--- boost/icl/concept/interval_bounds.hpp (revision 72177)
+++ boost/icl/concept/interval_bounds.hpp (working copy)
@@ -86,7 +86,7 @@
 {
     if(is_left_closed(decl) && !is_left_closed(repr))
     {
- BOOST_ASSERT((numeric_minimum<Type, is_numeric<Type>::value
>::is_less_than(low) ));
+ BOOST_ASSERT((numeric_minimum<Type, typename
is_numeric<Type>::value >::is_less_than(low) ));
         return icl::pred(low);
     }
     else if(!is_left_closed(decl) && is_left_closed(repr))
@@ -101,7 +101,7 @@
 {
     if(!is_right_closed(decl) && is_right_closed(repr))
     {
- BOOST_ASSERT((numeric_minimum<Type, is_numeric<Type>::value
>::is_less_than(up) ));
+ BOOST_ASSERT((numeric_minimum<Type, typename
is_numeric<Type>::value >::is_less_than(up) ));
         return icl::pred(up);
     }
     else if(is_right_closed(decl) && !is_right_closed(repr))
Index: boost/icl/open_interval.hpp
===================================================================
--- boost/icl/open_interval.hpp (revision 72177)
+++ boost/icl/open_interval.hpp (working copy)
@@ -48,7 +48,7 @@
         // Only for discrete types this ctor creates an interval containing
         // a single element only.
         BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value));
- BOOST_ASSERT((numeric_minimum<DomainT,
is_numeric<DomainT>::value >::is_less_than(val) ));
+ BOOST_ASSERT((numeric_minimum<DomainT, typename
is_numeric<DomainT>::value >::is_less_than(val) ));
     }

     /** Interval from <tt>low</tt> to <tt>up</tt> with bounds
<tt>bounds</tt> */
--- [/diff] ---

Can you fix it?

Thank you very much!!

Best,

-- Marco


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk