Boost logo

Boost Users :

Subject: Re: [Boost-users] challange to MPL gurus
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-12-13 09:15:56


On 12/12/11 23:30, Larry Evans wrote:
> On 12/12/11 22:49, Robert Ramey wrote:
[snip]
>> I moved it back in - and voila - worked as expected. Here is my solution:
>>
>>
>> template<typename I>
>> struct ForwardIterator {
>> template<typename I, typename B>
>> struct is_end {};
>>
>> template<typename I2>
>> struct is_end<I2, false_> {
>> typedef typename deref<I2>::type t1;
>> typedef typename next<I2>::type t2;
>> BOOST_CONCEPT_ASSERT(( ForwardIterator<t2> ));
>> };
>>
>> typedef typename is_end<
>> I,
>> typename boost::is_same<
>> boost::mpl::l_iter<boost::mpl::l_end>,
>> I
>> >
>> > type;
>> typedef typename boost::mpl::print<
>> I
>> >::type t1;
>>
>> BOOST_MPL_ASSERT((
>> is_convertible<
>> typename I::category,
>> forward_iterator_tag
>> >
>> ));
>> };
>>
[snip]
> I couldn't get this code to compile with gcc-4.7-20111008. Before any
> revision, got:
>
> ramey_iter_concept_check.cpp:22:14: error: declaration of 'class I'
> ramey_iter_concept_check.cpp:20:10: error: shadows template parm 'class I'
> ramey_iter_concept_check.cpp:32:22: error: expected nested-name-specifier
> ramey_iter_concept_check.cpp:38:7: error: invalid declarator before 'type'
>
> After eliminating the showing I, as shown in the attached, I got:
>
> /home/evansl/download/gcc/4.7-20111008/install/bin/g++ -c -Wall
> -Wstrict-overflow -ftemplate-depth-300 -O0 -g3 -fno-inline -std=gnu++0x
> -I/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox/ro/numeric_bindings
> -I/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox/rw/non_variadic_templates
> -I/home/evansl/prog_dev/boost-svn/ro/trunk -DTEMPLATE_DEPTH=300
> ramey_iter_concept_check.cpp -MMD -o
> build/gcc4_7n/boost-svn/ro/trunk/sandbox/rw/variadic_templates/libs/mpl/example/ramey_iter_concept_check.o
>
> ramey_iter_concept_check.cpp:31:22: error: expected nested-name-specifier
> ramey_iter_concept_check.cpp:37:7: error: invalid declarator before 'type'
> make: ***
> [build/gcc4_7n/boost-svn/ro/trunk/sandbox/rw/variadic_templates/libs/mpl/example/ramey_iter_concept_check.o]
> Error 1
>
> I guess you're using MS or an earlier gcc.
>
> -regards,
> Larry
Using the if_recur.hpp:

http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/if_recur.hpp

mentioned in one of my previous replies, the attached compiles; however,
I'm not sure it does what you want.
The in source comments reflect my questions.

-regards,
Larry




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net