Boost logo

Boost :

From: Pavol Droba (droba_at_[hidden])
Date: 2003-09-19 03:22:03


Hi,

I have a problem when using regex v4 from cvs. I'm porting my code from v3 to v4 version,
and I have encountered a problem when using regex_search.

One of the test cases I need to compile is trying to do something like this:

   vector<int> vec;
   regex rx("whatever");
   match_results m;

   regex_search( vec.begin(), vec.end(), m, rx, match_default );

My code is somewhat more complicated, but it is only forward to this call.
The problem occurs only when trying to search in the container with a different char_type then the one
in the regex. In version v3 it worked fine, I have only changed match_flags type from unsigned int to match_flag_type.
Has something changed since then?

I'm using vc7.0 and I got following error dump ( it is little bit longer ):

d:\Boost\boost\regex\v4\regex_search.hpp(42) : error C2664: 'boost::re_detail::perl_matcher<BidiIterator,Allocator,traits,Allocator2>::perl_matcher(BidiIterator,boost::string_algo::container_traits<T>::result_iterator,boost::match_results<RandomAccessIterator,Allocator> &,const boost::reg_expression<charT,traits,Allocator2> &,boost::regex_constants::match_flag_type)' : cannot convert parameter 4 from 'const boost::reg_expression<charT,traits,Allocator>' to 'const boost::reg_expression<charT,traits,Allocator> &'
        with
        [
            BidiIterator=boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,
            Allocator=boost::detail::allocator_adapter<boost::sub_match<boost::string_algo::detail::regex_search_result<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator>::iterator>,boost::detail::simple_alloc>,
            traits=boost::regex_traits<char>,
            Allocator2=boost::detail::allocator_adapter<char,boost::detail::simple_alloc>,
            T=std::vector<int,std::allocator<int>>,
            RandomAccessIterator=boost::string_algo::detail::regex_search_result<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator>::iterator,
            charT=boost::re_detail::perl_matcher<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,boost::detail::allocator_adapter<boost::sub_match<boost::string_algo::detail::regex_search_result<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator>::iterator>,boost::detail::simple_alloc>,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>>::char_type
        ]
        and
        [
            charT=char,
            traits=boost::regex_traits<char>,
            Allocator=boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
        ]
        and
        [
            charT=boost::re_detail::perl_matcher<boost::string
_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,boost::detail::allocator_adapter<boost::sub_match<boost::string_algo::detail::regex_search_result<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator>::iterator>,boost::detail::simple_alloc>,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>>::char_type,
            traits=boost::regex_traits<char>,
            Allocator=boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
        ]
        Reason: cannot convert from 'const boost::reg_expression<charT,traits,Allocator>' to 'const boost::reg_expression<charT,traits,Allocator>'
        with
        [
            charT=char,
            traits=boost::regex_traits<char>,
            Allocator=boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
        ]
        and
        [
            charT=boost::re_detail::perl_matcher<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,boost::detail::allocator_adapter<boost::sub_match<boost::string_algo::detail::regex_search_result<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator>::iterator>,boost::detail::simple_alloc>,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>>::char_type,
            traits=boost::regex_traits<char>,
            Allocator=boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
        ]
        No constructor could take the source type, or constructor overload resolution was ambiguous
        d:\Projects\Boost\string_algo\boost\string_algo\detail\find_regex.hpp(99) : see reference to function template instantiation 'bool boost::regex_search(BidiIterator,boost::string_algo::container_traits<T>::result_iterator,boost::match_results<RandomAccessIterator,Allocator> &,const boost::reg_expression<charT,traits,boost::detail::allocator_adapter<char,Base>> &,boost::regex_constants::match_flag_type)' being compiled
        with
        [
            BidiIterator=boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,
            T=std::vector<int,std::allocator<int>>,
            RandomAccessIterator=boost::string_algo::detail::regex_search_result<boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator>::iterator,
            Allocator=boost::detail::allocator_adapter<boost::sub_match<boost::string_algo::detail::regex_search_result<boost::string_algo::container_traits<
std::vector<int,std::allocator<int>>>::result_iterator>::iterator>,boost::detail::simple_alloc>,
            charT=char,
            traits=boost::regex_traits<char>,
            Base=boost::detail::simple_alloc
        ]
        d:\Projects\Boost\string_algo\boost\string_algo\detail\find_regex.hpp(116) : see reference to function template instantiation 'boost::string_algo::detail::regex_search_result<IteratorT> boost::string_algo::detail::find_regexF<RegExT>::operator ()(ForwardIteratorT,boost::string_algo::container_traits<T>::result_iterator) const' being compiled
        with
        [
            IteratorT=boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,
            RegExT=boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>>,
            ForwardIteratorT=boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,
            T=std::vector<int,std::allocator<int>>
        ]
        d:\Projects\Boost\string_algo\boost\string_algo\regex.hpp(51) : see reference to function template instantiation 'boost::string_algo::detail::regex_search_result<IteratorT> boost::string_algo::detail::find_regexF<RegExT>::operator ()(InputT &) const' being compiled
        with
        [
            IteratorT=boost::string_algo::container_traits<std::vector<int,std::allocator<int>>>::result_iterator,
            RegExT=boost::reg_expression<char,boost::regex_traits<char>,boost::detail::allocator_adapter<char,boost::detail::simple_alloc>>,
            InputT=std::vector<int,std::allocator<int>>
        ]
        d:\Projects\Boost\string_algo\libs\string_algo\test\regex_test.cpp(55) : see reference to function template instantiation 'boost::iterator_range<IteratorT> boost::find_regex(InputT &,const boost::reg_expression<charT,traits,Allocator> &,boost::regex_constants::match_flag_type)' being compiled
        with
        [
            IteratorT=std::vector<int,std::allocator<int>>::iterator
,
            InputT=std::vector<int,std::allocator<int>>,
            charT=char,
            traits=boost::regex_traits<char>,
            Allocator=boost::detail::allocator_adapter<char,boost::detail::simple_alloc>
        ]

Thanks,

Pavol


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk