[C++-sig] compile error in iterator
Kelly Burkhart
kelly.burkhart at gmail.com
Tue Nov 28 00:14:03 CET 2006
I have a GzipFile class which exposes a gzipped file as a python file.
I have written an iterator over this class which I use to iterate
over an instance of this class.
I'm using 1.33.1 and my code compiles cleanly and works on Linux g++
3.3.5. I am now trying to build on Windows using msvc.net (cl
13.10.6030). This compiler complains that
bost::python::objects::iterator_range<NextPolicies,Iterator>::next is
not accessible (full compiler complaint below).
Does anyone have a solution, or hint to how I can go about fixing
this? Thank you in advance for any assistance.
This code reproduces the problem:
<begin>
#include <boost/python.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <vector>
#include <string>
using namespace boost::python;
//--------------------------------------------------------------------------------------------------
//
class ItTstIterator : public boost::iterator_facade< ItTstIterator,
std::string,
boost::forward_traversal_tag,
std::string >
{
public:
ItTstIterator( std::vector<std::string>::iterator it ) : it_(it) {}
virtual ~ItTstIterator() {}
private:
friend class boost::iterator_core_access;
void increment() { ++it_; }
bool equal( const ItTstIterator &it ) const { return it_ == it.it_; }
std::string dereference() const { return *it_; }
private:
std::vector<std::string>::iterator it_;
};
//--------------------------------------------------------------------------------------------------
class ItTst {
public:
typedef ItTstIterator iterator;
ItTst() { vec_.push_back("one");vec_.push_back("two");vec_.push_back("three");
}
~ItTst() {}
// For iteration
ItTstIterator begin() { return ItTstIterator( vec_.begin() ); }
ItTstIterator end() { return ItTstIterator( vec_.end() ); }
private:
std::vector< std::string > vec_;
};
void wrapPyIter()
{
class_<ItTst>("ItTst", init<>() )
.def("__iter__", iterator<ItTst>())
;
}
<end>
And here is the full compiler complaint:
cl -c -nologo -GX -GR -Zc:forScope -wd4101 -wd4290 -wd4100 -wd4189
-DWIN32 -Zi -Od -D_DEBUG -DFD_SETSIZE=512 -MDd -Zi -Od -D_DEBUG
-DFD_SETSIZE=512 -MDd -DBOOST_SIGNALS_NAMESPACE=tb_signals -D__x86__
-D__NT__ -D__OSVERSION__=5 -D__WIN32__ -GR -EHsc -W3 -w34100 -w34189
-DWIN32 -DQT_LARGEFILE_SUPPORT -DCOMPILE_DL=1 -DQT_DLL -DQT_PLUGIN
-DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_XML_LIB -DQT_GUI_LIB
-DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT
-D_WIN32_WINNT=0x0500 -DFD_SETSIZE=512 -DNOMINMAX
-I"C:/Qt/4.2.1/include/QtCore" -I"C:/Qt/4.2.1/include/QtCore"
-I"C:/Qt/4.2.1/include/QtNetwork" -I"C:/Qt/4.2.1/include/QtNetwork"
-I"C:/Qt/4.2.1/include/QtGui" -I"C:/Qt/4.2.1/include/QtGui"
-I"C:/Qt/4.2.1/include/QtXml" -I"C:/Qt/4.2.1/include/QtXml"
-I"C:/Qt/4.2.1/include/Qt3Support" -I"C:/Qt/4.2.1/include/Qt3Support"
-I"C:/Qt/4.2.1/include" -I"..\Common" -I"..\libtbut"
-I"C:/Qt/4.2.1/include/ActiveQt" -I"moc" -I"..\libtbut" -I"ui"
-I"C:/postgresql\src\interfaces\libpq" -I"C:/postgresql\src\include"
-I"C:/Python25/include" -I"C:/Boost/include/boost-1_33_1"
-I"c:\omni\omniORB-4.0.3\include"
-I"c:\Qt\4.2.1\mkspecs\win32-msvc.net" -Fodebug\
@c:\DOCUME~1\kelly\LOCALS~1\Temp\nm99.tmp
wrap_py_iter.cpp
C:/Boost\include\boost-1_33_1\boost\detail\compressed_pair.hpp(347) :
error C2247: 'boost::python::objects::iterator_range<NextPolicies,Iterator>::next'
not accessible because
'boost::details::compressed_pair_imp<T1,T2,Version>' uses 'private' to
inherit from 'boost::python::objects::iterator_range<NextPolicies,Iterator>::next'
with
[
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Iterator=iterator_const
]
and
[
T1=boost::python::objects::iterator_range<boost::python::return_value_policy<boost::python::return_by_value>,iterator_const>::next,
T2=boost::python::return_value_policy<boost::python::return_by_value>,
Version=3
]
and
[
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Iterator=iterator_const
]
C:/Boost\include\boost-1_33_1\boost\python\object\iterator.hpp(51)
: see declaration of
'boost::python::objects::iterator_range<NextPolicies,Iterator>::next'
with
[
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Iterator=iterator_const
]
C:/Boost\include\boost-1_33_1\boost\python\object\iterator.hpp(51)
: see declaration of
'boost::python::objects::iterator_range<NextPolicies,Iterator>::next'
with
[
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Iterator=iterator_const
]
C:/Boost\include\boost-1_33_1\boost\python\detail\caller.hpp(212)
: see reference to class template instantiation
'boost::compressed_pair<T1,T2>' being compiled
with
[
T1=boost::python::objects::iterator_range<boost::python::return_value_policy<boost::python::return_by_value>,iterator_const>::next,
T2=boost::python::return_value_policy<boost::python::return_by_value>
]
C:/Boost\include\boost-1_33_1\boost\python\detail\caller.hpp(145)
: see reference to class template instantiation
'boost::python::detail::caller_arity<1>::impl<F,Policies,Sig>' being
compiled
with
[
F=boost::python::objects::iterator_range<boost::python::return_value_policy<boost::python::return_by_value>,iterator_const>::next,
Policies=boost::python::return_value_policy<boost::python::return_by_value>,
Sig=boost::mpl::vector2<result_type,range_ &>
]
C:/Boost\include\boost-1_33_1\boost\python\make_function.hpp(37)
: see reference to class template instantiation
'boost::python::detail::caller<F,CallPolicies,Sig>' being compiled
with
[
F=boost::python::objects::iterator_range<boost::python::return_value_policy<boost::python::return_by_value>,iterator_const>::next,
CallPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Sig=boost::mpl::vector2<result_type,range_ &>
]
C:/Boost\include\boost-1_33_1\boost\python\make_function.hpp(89)
: see reference to function template instantiation
'boost::python::api::object
boost::python::detail::make_function_aux<F,CallPolicies,Signature>(F,const
CallPolicies &,const Sig &)' being compiled
with
[
F=boost::python::objects::iterator_range<boost::python::return_value_policy<boost::python::return_by_value>,iterator_const>::next,
CallPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Signature=boost::mpl::vector2<result_type,range_ &>,
Sig=boost::mpl::vector2<result_type,range_ &>
]
C:/Boost\include\boost-1_33_1\boost\python\make_function.hpp(129)
: see reference to function template instantiation
'boost::python::api::object
boost::python::detail::make_function_dispatch<F,CallPolicies,KeywordsOrSignature>(F,const
CallPolicies &,const Signature &,boost::mpl::false_)' being compiled
with
[
F=boost::python::objects::iterator_range<boost::python::return_value_policy<boost::python::return_by_value>,iterator_const>::next,
CallPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
KeywordsOrSignature=boost::mpl::vector2<result_type,range_ &>,
Signature=boost::mpl::vector2<result_type,range_ &>
]
C:/Boost\include\boost-1_33_1\boost\python\object\iterator.hpp(137)
: see reference to function template instantiation
'boost::python::api::object
boost::python::make_function<boost::python::objects::iterator_range<NextPolicies,Iterator>::next,NextPolicies,boost::mpl::vector2<T0,T1>>(F,const
CallPolicies &,const KeywordsOrSignature &)' being compiled
with
[
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Iterator=iterator_const,
T0=result_type,
T1=range_ &,
F=boost::python::objects::iterator_range<boost::python::return_value_policy<boost::python::return_by_value>,iterator_const>::next,
CallPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
KeywordsOrSignature=boost::mpl::vector2<result_type,range_ &>
]
C:/Boost\include\boost-1_33_1\boost\python\object\iterator.hpp(163)
: see reference to function template instantiation
'boost::python::api::object
boost::python::objects::detail::demand_iterator_class<Iterator,boost::python::return_value_policy<ResultConverterGenerator>>(const
char *,Iterator *,const NextPolicies &)' being compiled
with
[
Iterator=const iterator_const,
ResultConverterGenerator=boost::python::return_by_value,
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>
]
C:/Boost\include\boost-1_33_1\boost\python\object\iterator.hpp(161)
: while compiling class-template member function
'boost::python::objects::iterator_range<NextPolicies,Iterator>
boost::python::objects::detail::py_iter_<Target,Iterator,Accessor1,Accessor2,NextPolicies>::operator
()(boost::python::back_reference<T>) const'
with
[
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Iterator=iterator_const,
Target=ItTst,
Accessor1=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
Accessor2=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
T=ItTst &
]
C:/Boost\include\boost-1_33_1\boost\python\object\iterator.hpp(187)
: see reference to class template instantiation
'boost::python::objects::detail::py_iter_<Target,Iterator,Accessor1,Accessor2,NextPolicies>'
being compiled
with
[
Target=ItTst,
Iterator=iterator_const,
Accessor1=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
Accessor2=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>
]
C:/Boost\include\boost-1_33_1\boost\python\object\iterator.hpp(239)
: see reference to function template instantiation
'boost::python::api::object
boost::python::objects::detail::make_iterator_function<Target,T,NextPolicies,Accessor1,Accessor2>(const
Accessor1 &,const Accessor2 &,const NextPolicies &,Iterator &(__cdecl
*)(void),boost::type<Target> *,int)' being compiled
with
[
Target=ItTst,
T=const iterator_const,
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Accessor1=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
Accessor2=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
Iterator=const iterator_const
]
C:/Boost\include\boost-1_33_1\boost\python\iterator.hpp(39) :
see reference to function template instantiation
'boost::python::api::object
boost::python::objects::make_iterator_function<Target,NextPolicies,boost::_bi::protected_bind_t<F>,boost::_bi::protected_bind_t<F>>(const
Accessor1 &,const Accessor2 &,const NextPolicies &,boost::type<T> *)'
being compiled
with
[
Target=ItTst,
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
F=boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>,
Accessor1=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
Accessor2=boost::_bi::protected_bind_t<boost::_bi::bind_t<boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator,boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst
&),boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>>,
T=ItTst
]
C:/Boost\include\boost-1_33_1\boost\python\iterator.hpp(96) :
see reference to function template instantiation
'boost::python::api::object
boost::python::detail::make_iterator<T,boost::python::detail::iterators_impl<const_>::apply<T>::iterator(__cdecl
*)(T &),boost::python::detail::iterators_impl<const_>::apply<T>::iterator(__cdecl
*)(T &),boost::python::return_value_policy<ResultConverterGenerator>>(Accessor1,Accessor2,NextPolicies,Target
&(__cdecl *)(void))' being compiled
with
[
T=ItTst,
const_=false,
ResultConverterGenerator=boost::python::return_by_value,
Accessor1=boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst &),
Accessor2=boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst &),
NextPolicies=boost::python::return_value_policy<boost::python::return_by_value>,
Target=ItTst
]
C:/Boost\include\boost-1_33_1\boost\python\iterator.hpp(120) :
see reference to function template instantiation
'boost::python::api::object
boost::python::range<NextPolicies,boost::python::detail::iterators_impl<const_>::apply<T>::iterator(__cdecl
*)(T &),boost::python::detail::iterators_impl<const_>::apply<T>::iterator(__cdecl
*)(T &)>(Accessor1,Accessor2,NextPolicies *)' being compiled
with
[
NextPolicies=boost::python::objects::default_iterator_call_policies,
const_=false,
T=ItTst,
Accessor1=boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst &),
Accessor2=boost::python::detail::iterators_impl<false>::apply<ItTst>::iterator
(__cdecl *)(ItTst &)
]
C:/Boost\include\boost-1_33_1\boost\python\iterator.hpp(116) :
while compiling class-template member function
'boost::python::iterator<Container>::iterator(void)'
with
[
Container=ItTst
]
wrap_py_iter.cpp(48) : see reference to class template
instantiation 'boost::python::iterator<Container>' being compiled
with
[
Container=ItTst
]
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio
.NET 2003\VC7\BIN\nmake.exe"' : return code '0x2'
Stop.
More information about the Cplusplus-sig
mailing list