[counting_range] why?

Ok, maybe I'm having a senior moment here, but why is the second line wrong?
Thx, Rob.
#include

Here's the compiler output....
|| ~/local/gcc-4.6.2/bin/g++ -std=c++0x -I ~/local/boost_1_48_0/include -g
-W -fno-strict-aliasing -fno-inline -Wno-uninitialized -Wcast-align
-Wwrite-strings -Wnon-virtual-dtor -Wextra -c -o range_for.o range_for.cpp
In file included from
/home/rjones/local/boost_1_48_0/include/boost/iterator/iterator_categories.hpp|15|
0,
|| from
/home/rjones/local/boost_1_48_0/include/boost/iterator/detail/facade_iterator_category.hpp:7,
|| from
/home/rjones/local/boost_1_48_0/include/boost/iterator/iterator_facade.hpp:14,
|| from
/home/rjones/local/boost_1_48_0/include/boost/range/iterator_range_core.hpp:23,
|| from
/home/rjones/local/boost_1_48_0/include/boost/range/counting_range.hpp:18,
|| from range_for.cpp:1:
|| /home/rjones/local/boost_1_48_0/include/boost/mpl/eval_if.hpp: In
instantiation of ‘boost::mpl::eval_if_c

On Wed, Nov 28, 2012 at 9:41 AM, Robert Jones
Looks like gcc is instantiating the unary overloads of counting_range (with template parameter int) even though you're supplying 2 arguments...I'm not sure if that is standard behavior or not; MSVC9 seems to do okay with it. Is this is a real hindrance or merely curiosity? - Jeff

On Wed, Nov 28, 2012 at 5:56 PM, Jeffrey Lee Hellrung, Jr. < jeffrey.hellrung@gmail.com> wrote:
More curiosity now, as I can do what I need to do, but where I started from was... counting_range<unsigned>( 0, 3 ) So using arguments of type int, in a range of type unsigned, which doesn't work. I can of course do counting_range( 0U, 3U ) to get the same effect, but it's a bit inelegant! I haven't investigated what counting_range( 0U, 3 ) does! Thx, Rob.

On Wed, Nov 28, 2012 at 10:05 AM, Robert Jones
Probably won't work :) Sounds like your initial use case *should* be okay (seems to work on clang and msvc) and your version of gcc is incorrect in rejecting it. Consider reducing your use case down to be Boost-independent and filing a bug with gcc. - Jeff

On Nov 28, 2012, at 9:36 AM, "Jeffrey Lee Hellrung, Jr."
Compiles fine for me with clang. -- Marshall Marshall Clow Idio Software mailto:mclow.lists@gmail.com A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki
participants (3)
-
Jeffrey Lee Hellrung, Jr.
-
Marshall Clow
-
Robert Jones