Boost logo

Boost Users :

Subject: [Boost-users] Boost String Algo Compilation failure
From: Narinder Claire (narinder.claire_at_[hidden])
Date: 2011-07-20 14:37:01


Hello

The following piece won't code :

-----------------------------------
#include<string>
#include<vector>
#include<boost/algorithm/string.hpp>

int main()
{
    std::string str1("hello abc-*-ABC-*-aBc goodbye");

    typedef std::vector< std::string > split_vector_type;

    split_vector_type SplitVec; // #2: Search for tokens
    boost::split( SplitVec, str1, boost::is_any_of("-*"),
boost::token_compress_on );

}
-----------------------------------------

compiles successfully with gcc 4.5.2(Linux) & VS2008 but fails with
VS2010 with the following output:

------------------------------------------
1>------ Build started: Project: main, Configuration: Debug Win32 ------
1> main.cpp
1>c:\boost_1_47_0\boost\algorithm\string\find_iterator.hpp(184):
warning C4224: nonstandard extension used : formal parameter
'Collection' was previously defined as a type
1>c:\boost_1_47_0\boost\algorithm\string\find_iterator.hpp(364):
warning C4224: nonstandard extension used : formal parameter
'Collection' was previously defined as a type
1>c:\program files (x86)\microsoft visual studio
10.0\vc\include\xutility(2227): warning C4996: 'std::_Copy_impl':
Function call with parameters that may be unsafe - this call relies on
the caller to check that the passed values are correct. To disable
this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how
to use Visual C++ 'Checked Iterators'
1> c:\program files (x86)\microsoft visual studio
10.0\vc\include\xutility(2212) : see declaration of 'std::_Copy_impl'
1> c:\boost_1_47_0\boost\algorithm\string\detail\classification.hpp(102)
: see reference to function template instantiation '_OutIt
std::copy<const char*,char*>(_InIt,_InIt,_OutIt)' being compiled
1> with
1> [
1> _OutIt=char *,
1> _InIt=const char *
1> ]
1> c:\boost_1_47_0\boost\algorithm\string\classification.hpp(206)
: see reference to function template instantiation
'boost::algorithm::detail::is_any_ofF<CharT>::is_any_ofF<boost::iterator_range<IteratorT>>(const
RangeT &)' being compiled
1> with
1> [
1> CharT=char,
1> IteratorT=const char *,
1> RangeT=boost::iterator_range<const char *>
1> ]
1> d:\workspace\papafactory\develop\boost.string.split\main.cpp(15)
: see reference to function template instantiation
'boost::algorithm::detail::is_any_ofF<CharT>
boost::algorithm::is_any_of<const char[3]>(RangeT (&))' being compiled
1> with
1> [
1> CharT=char,
1> RangeT=const char [3]
1> ]
1>c:\boost_1_47_0\boost\range\concepts.hpp(140): error C2146: syntax
error : missing ',' before identifier 'traversal_category'
1> c:\boost_1_47_0\boost\concept\detail\has_constraints.hpp(42)
: see reference to class template instantiation
'boost::range_detail::SinglePassIteratorConcept<Iterator>' being
compiled
1> with
1> [
1>
Iterator=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>
1> ]
1> c:\boost_1_47_0\boost\concept\detail\msvc.hpp(53) : see
reference to class template instantiation
'boost::concepts::not_satisfied<Model>' being compiled
1> with
1> [
1>
Model=boost::range_detail::SinglePassIteratorConcept<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>>
1> ]
1> c:\boost_1_47_0\boost\range\concepts.hpp(259) : see
reference to class template instantiation
'boost::concepts::require<Model>' being compiled
1> with
1> [
1>
Model=boost::range_detail::SinglePassIteratorConcept<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>>
1> ]
1> c:\boost_1_47_0\boost\concept\detail\has_constraints.hpp(42)
: see reference to class template instantiation
'boost::SinglePassRangeConcept<T>' being compiled
1> with
1> [
1> T=const
boost::iterator_range<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>>
1> ]
1> c:\boost_1_47_0\boost\concept\detail\msvc.hpp(53) : see
reference to class template instantiation
'boost::concepts::not_satisfied<Model>' being compiled
1> with
1> [
1> Model=boost::SinglePassRangeConcept<const
boost::iterator_range<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>>>
1> ]
1> c:\boost_1_47_0\boost\range\algorithm\equal.hpp(162) : see
reference to class template instantiation
'boost::concepts::require<Model>' being compiled
1> with
1> [
1> Model=boost::SinglePassRangeConcept<const
boost::iterator_range<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>>>
1> ]
1> c:\boost_1_47_0\boost\range\iterator_range_core.hpp(434) :
see reference to function template instantiation 'bool
boost::range::equal<boost::iterator_range<IteratorT>,boost::iterator_range<IteratorT>>(const
SinglePassRange1 &,const SinglePassRange2 &)' being compiled
1> with
1> [
1>
IteratorT=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>,
1>
SinglePassRange1=boost::iterator_range<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>>,
1>
SinglePassRange2=boost::iterator_range<std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>>
1> ]
1> c:\boost_1_47_0\boost\algorithm\string\find_iterator.hpp(328)
: see reference to function template instantiation 'bool
boost::operator ==<IteratorT,IteratorT>(const
boost::iterator_range<IteratorT> &,const
boost::iterator_range<IteratorT> &)' being compiled
1> with
1> [
1>
IteratorT=std::_String_iterator<char,std::char_traits<char>,std::allocator<char>>
1> ]
1> c:\boost_1_47_0\boost\algorithm\string\find_iterator.hpp(322)
: while compiling class template member function 'bool
boost::algorithm::split_iterator<IteratorT>::equal(const
boost::algorithm::split_iterator<IteratorT> &) const'
1> with
1> [
1> IteratorT=input_iterator_type
1> ]
1> c:\program files (x86)\microsoft visual studio
10.0\vc\include\xutility(373) : see reference to class template
instantiation 'boost::algorithm::split_iterator<IteratorT>' being
compiled
1> with
1> [
1> IteratorT=input_iterator_type
1> ]
1> c:\boost_1_47_0\boost\iterator\transform_iterator.hpp(49)
: see reference to class template instantiation
'std::iterator_traits<_Iter>' being compiled
1> with
1> [
1> _Iter=find_iterator_type
1> ]
1> c:\boost_1_47_0\boost\iterator\transform_iterator.hpp(75)
: see reference to class template instantiation
'boost::detail::transform_iterator_base<UnaryFunc,Iterator,Reference,Value>'
being compiled
1> with
1> [
1> UnaryFunc=copy_range_type,
1> Iterator=find_iterator_type,
1> Reference=boost::use_default,
1> Value=boost::use_default
1> ]
1> c:\boost_1_47_0\boost\algorithm\string\iter_find.hpp(168)
: see reference to class template instantiation
'boost::transform_iterator<UnaryFunc,Iterator>' being compiled
1> with
1> [
1> UnaryFunc=copy_range_type,
1> Iterator=find_iterator_type
1> ]
1> c:\boost_1_47_0\boost\algorithm\string\split.hpp(149) :
see reference to function template instantiation 'SequenceSequenceT
&boost::algorithm::iter_split<SequenceSequenceT,RangeT,boost::algorithm::detail::token_finderF<PredicateT>>(SequenceSequenceT
&,RangeT &,FinderT)' being compiled
1> with
1> [
1> SequenceSequenceT=split_vector_type,
1> RangeT=std::string,
1> PredicateT=boost::algorithm::detail::is_any_ofF<char>,
1>
FinderT=boost::algorithm::detail::token_finderF<boost::algorithm::detail::is_any_ofF<char>>
1> ]
1> d:\workspace\p\develop\boost.string.split\main.cpp(15) :
see reference to function template instantiation 'SequenceSequenceT
&boost::algorithm::split<split_vector_type,std::string,boost::algorithm::detail::is_any_ofF<CharT>>(SequenceSequenceT
&,RangeT &,PredicateT,boost::algorithm::token_compress_mode_type)'
being compiled
1> with
1> [
1> SequenceSequenceT=split_vector_type,
1> CharT=char,
1> RangeT=std::string,
1> PredicateT=boost::algorithm::detail::is_any_ofF<char>
1> ]
1>c:\boost_1_47_0\boost\range\concepts.hpp(140): error C2065:
'traversal_category' : undeclared identifier
1>c:\boost_1_47_0\boost\range\concepts.hpp(140): error C2146: syntax
error : missing ',' before identifier 'traversal_category'
1>c:\boost_1_47_0\boost\range\concepts.hpp(140): error C2065:
'traversal_category' : undeclared identifier
1>c:\boost_1_47_0\boost\range\concepts.hpp(140): error C2893: Failed
to specialize function template 'boost::concepts::require<Model>
boost::concepts::require_(void (*)(Model))'
1> With the following template arguments:
1> 'boost::Convertible'
1>c:\boost_1_47_0\boost\range\concepts.hpp(140): error C2056: illegal expression
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


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