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,
int main()
{
silly_adaptor x;
return 0;
}
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;
}