QStringList和boost:any_range

时间:2015-09-04 09:55:24

标签: c++ qt boost

如何强制QStringList转换为boost::any_range?我来到以下代码:

typedef boost::any_range<QString, boost::forward_traversal_tag, QString, std::ptrdiff_t> NamesRange;
void myfunc(const NamesRange& strs) { /* calling for each on strs etc. */ }; 
myfunc(QStringList() << "A" << "B" << "C");

但它不能用boost 1.58.0和VS2010编译。在我们升级到最新版本的boost之前,我确信它有效。但现在我无法尝试以前的版本。

我不确定是否应该将整个错误消息放在此处,因为它长达几页(因为模板错误消息可以)。好吧,这是:

c:\views\DEV2\boost\1.58.0\boost/range/mutable_iterator.hpp(37): error C2146: syntax error : missing ';' before identifier 'type' 23> c:\views\DEV2\boost\1.58.0\boost/range/mutable_iterator.hpp(43) : see reference to class template instantiation 'boost::range_detail::extract_iterator<C>' being compiled 23> with 23> [ 23> C=QList<QString>::iterator 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/range/has_range_iterator.hpp(27) : see reference to class template instantiation 'boost::range_detail::range_mutable_iterator<C>' being compiled 23> with 23> [ 23> C=QList<QString>::iterator 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/mpl/eval_if.hpp(41) : see reference to class template instantiation 'boost::range_detail::has_type<T,fallback_>' being compiled 23> with 23> [ 23> T=boost::range_detail::range_mutable_iterator<QList<QString>::iterator>, 23> fallback_=boost::mpl::bool_<false> 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/range/has_range_iterator.hpp(73) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled 23> with 23> [ 23> C=boost::is_const<QList<QString>::iterator>, 23> F1=boost::range_detail::has_type<boost::range_detail::range_const_iterator<QList<QString>::iterator>,boost::mpl::bool_<false>>, 23> F2=boost::range_detail::has_type<boost::range_detail::range_mutable_iterator<QList<QString>::iterator>,boost::mpl::bool_<false>> 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/mpl/if.hpp(63) : see reference to class template instantiation 'boost::has_range_iterator<T>' being compiled 23> with 23> [ 23> T=QList<QString>::iterator 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/mpl/eval_if.hpp(40) : see reference to class template instantiation 'boost::mpl::if_<T1,T2,T3>' being compiled 23> with 23> [ 23> T1=boost::has_range_iterator<QList<QString>::iterator>, 23> T2=boost::range_iterator<QList<QString>::iterator>, 23> T3=boost::mpl::identity<void> 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/range/iterator_range_core.hpp(451) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled 23> with 23> [ 23> C=boost::has_range_iterator<QList<QString>::iterator>, 23> F1=boost::range_iterator<QList<QString>::iterator>, 23> F2=boost::mpl::identity<void> 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/mpl/aux_/preprocessed/plain/and.hpp(25) : see reference to class template instantiation 'boost::iterator_range<IteratorT>::is_compatible_range_<Source>' being compiled 23> with 23> [ 23> IteratorT=boost::range_detail::any_iterator<QString,boost::iterators::forward_traversal_tag,QString,ptrdiff_t,boost::any_iterator_buffer<0x040>>, 23> Source=QList<QString>::iterator 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/mpl/aux_/preprocessed/plain/and.hpp(55) : see reference to class template instantiation 'boost::mpl::aux::and_impl<C_,T1,T2,T3,T4>' being compiled 23> with 23> [ 23> C_=true, 23> T1=boost::iterator_range<boost::range_detail::any_iterator<QString,boost::iterators::forward_traversal_tag,QString,ptrdiff_t,boost::any_iterator_buffer<0x040>>>::is_compatible_range_<QList<QString>::iterator>, 23> T2=boost::mpl::true_, 23> T3=boost::mpl::true_, 23> T4=boost::mpl::true_ 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/range/iterator_range_core.hpp(468) : see reference to class template instantiation 'boost::mpl::and_<T1,T2>' being compiled 23> with 23> [ 23> T1=boost::mpl::not_<boost::is_convertible<QList<QString>::iterator,boost::range_detail::any_iterator<QString,boost::iterators::forward_traversal_tag,QString,ptrdiff_t,boost::any_iterator_buffer<0x040>>>>, 23> T2=boost::iterator_range<boost::range_detail::any_iterator<QString,boost::iterators::forward_traversal_tag,QString,ptrdiff_t,boost::any_iterator_buffer<0x040>>>::is_compatible_range_<QList<QString>::iterator> 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/core/enable_if.hpp(36) : see reference to class template instantiation 'boost::iterator_range<IteratorT>::is_compatible_range<Source>' being compiled 23> with 23> [ 23> IteratorT=boost::range_detail::any_iterator<QString,boost::iterators::forward_traversal_tag,QString,ptrdiff_t,boost::any_iterator_buffer<0x040>>, 23> Source=QList<QString>::iterator 23> ] 23> c:\views\DEV2\boost\1.58.0\boost/range/any_range.hpp(124) : see reference to class template instantiation 'boost::enable_if<Cond,T>' being compiled 23> with 23> [ 23> Cond=boost::iterator_range<boost::range_detail::any_iterator<QString,boost::iterators::forward_traversal_tag,QString,ptrdiff_t,boost::any_iterator_buffer<0x040>>>::is_compatible_range<QList<QString>::iterator>, 23> T=void 23> ] 23> ..\..\..\..\..\mypath\myfile.cpp(118) : see reference to function template instantiation 'boost::range_detail::any_range<Value,Traversal,Reference,Difference>::any_range<QStringList>(WrappedRange &)' being compiled 23> with 23> [ 23> Value=QString, 23> Traversal=boost::iterators::forward_traversal_tag, 23> Reference=QString, 23> Difference=ptrdiff_t, 23> WrappedRange=QStringList 23> ] 23>c:\views\DEV2\boost\1.58.0\boost/range/mutable_iterator.hpp(37): error C3254: 'boost::range_detail::extract_iterator<C>' : class contains explicit override '{ctor}' but does not derive from an interface that contains the function declaration 23> with 23> [ 23> C=QList<QString>::iterator 23> ] 23>c:\views\DEV2\boost\1.58.0\boost/range/mutable_iterator.hpp(37): error C2838: '{ctor}' : illegal qualified name in member declaration 23>c:\views\DEV2\boost\1.58.0\boost/range/mutable_iterator.hpp(37): error C2461: 'boost::range_detail::extract_iterator<C>' : constructor syntax missing formal parameters 23> with 23> [ 23> C=QList<QString>::iterator 23> ] 23>c:\views\DEV2\boost\1.58.0\boost/range/mutable_iterator.hpp(37): error C2208: 'boost::type' : no members defined using this type 23>c:\views\DEV2\boost\1.58.0\boost/range/mutable_iterator.hpp(37): fatal error C1903: unable to recover from previous error(s); stopping compilation

0 个答案:

没有答案