counting_iterator with transform_iterator ?

P

Paul

Hi all,

I'm hoping someone can tell me what is wrong with the code below.
Basically, I want to take a counting_iterator and then transform it with
a transform_iterator.

This is currently very simple, but the intended context is more elaborate.

It seems that compressed_pair is used to store the objects, but it wants
iterator_traits<> for the counting_iterator. C++ seems to have all
sorts of problems trying to figure it out. This tiny program manages to
generate over 8600 lines of errors !!

Here are some of the error messages (from gcc 2.95.4)

/usr/include/boost/type_traits/is_arithmetic.hpp:32: template
instantiation depth exceeds maximum of 17
/usr/include/boost/type_traits/is_arithmetic.hpp:32: (use
-ftemplate-depth-NN to increase the maximum)
/usr/include/boost/type_traits/is_arithmetic.hpp:32: instantiating
`boost::mpl::bool_<true>::value'
/usr/include/boost/type_traits/is_arithmetic.hpp:32: instantiated from
`boost::detail::is_arithmetic_impl<int>'

.... and so on, until much much later on:

/usr/include/boost/detail/call_traits.hpp:86: `value' is not a member of
type `boost::is_pointer<boost::counting_iterator_policies<int> >'
/usr/include/boost/detail/call_traits.hpp:86: `value' is not a member of
type `boost::is_arithmetic<boost::counting_iterator_policies<int> >'
/usr/include/boost/detail/call_traits.hpp:86: template argument 2 is invalid
/usr/include/boost/detail/call_traits.hpp:86: template argument 3 is invalid

.... and finally at the very end:

/usr/include/boost/detail/compressed_pair.hpp:355: no type named
`param_type' in `struct
boost::call_traits<boost::counting_iterator_policies<int> >'
/usr/include/boost/detail/compressed_pair.hpp:362: no type named
`param_type' in `struct
boost::call_traits<boost::counting_iterator_policies<int> >'
/usr/include/boost/detail/compressed_pair.hpp:362: no type named
`param_type' in `struct boost::call_traits<int>'
/usr/include/boost/detail/compressed_pair.hpp:362: confused by earlier
errors, bailing out



What is wrong?

Thanks,
Paul




#include <boost/counting_iterator.hpp>
#include <functional>
#include <boost/iterator_adaptors.hpp>
using namespace boost;


struct Function : public unary_function< int, int >
{
const result_type& operator()( const argument_type& t ) const
{ return t; }
};
typedef boost::transform_iterator_generator< Function,
boost::counting_iterator_generator said:
::type silly_adaptor;


int main()
{
silly_adaptor x;
return 0;
}
 
J

Joe

Never mind, stupid me, turns out I just needed to add the flag
-ftemplate-depth-30, and that fixed it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,155
Messages
2,570,871
Members
47,401
Latest member
CliffGrime

Latest Threads

Top