Boost logo

Boost Users :

From: I.B. (ig3v10_at_[hidden])
Date: 2006-12-21 12:38:04


yeas! it was iterator! it works now.
thanx,
igRek

On 12/16/06, John Maddock <john_at_[hidden]> wrote:
> I.B. wrote:
> >> Hi ,
> >>
> >>
> >> i want to use boost regex++ for my project but dont want to compile
> >> all boost libraries for now,
> >> so i compiled using option:
> >> --with-regex
> >>
> >> got no errors, and result library:
> >> boost_regex-gcc-1_33_1.a
> >>
> >> copied all boost_<version>/boost headers to $HOME/include
> >>
> >> directory is like this:
> >> $HOME/include/boost/regex.hpp
> >>
> >> have a simple test.cpp file that uses:
> >>
> >> boost::regex_search(...)
> >>
> >> i compiled like this:
> >> g++ -o trun test.cpp -I/home/ig3/include -L/home/ig3/lib
> >> -lboost_regex-gcc-1_33_1
> >>
> >>
> >> got following error:
> >>
> >> test.cpp: In function `int main(int, char**)':
> >> test.cpp:26: no matching function for call to `regex_search(
> >> __gnu_cxx::__normal_iterator<const char*, std::basic_string<char,
> >> std::char_traits<char>, std::allocator<char> > >&,
> >> __gnu_cxx::__normal_iterator<char*, std::basic_string<char,
> >> std::char_traits<char>, std::allocator<char> > >, boost::cmatch&,
> >> boost::regex&)'
> >>
> >> i wonder why is that. Thought iterator is a template that shouldnt be
> >> compiled. Headers should be enough.
>
> You've mixed your iterators up: you are passing std::string::iterator's to
> the function, but using boost::cmatch to accept the result (cmatch expects a
> const char* and *not* a string::iterator). Use boost::smatch to accept the
> result instead.
>
> Note: with some std lib's, std::string::iterator happens to be the type
> const char* and your code would compile. You can not rely on this in
> general though.
>
> HTH,
>
> John.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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