
Still i am getting the following error. regex.cpp: In function ‘void print_captures(const std::string&, const std::string&)’: regex.cpp:20: error: ‘const struct boost::sub_match<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >’ has no member named ‘size’ regex.cpp:26: error: no match for ‘operator[]’ in ‘what.boost::match_results<BidiIterator, Allocator>::operator[] [with BidiIterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Allocator = std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
](((int)i))[j]’ manish@user-desktop:~/Desktop$ g++ -ggdb -lboost_regex regex.cpp regex.cpp: In function ‘void print_captures(const std::string&, const std::string&)’: regex.cpp:20: error: ‘const struct boost::sub_match<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >’ has no member named ‘size’ regex.cpp:26: error: no match for ‘operator[]’ in ‘what.boost::match_results<BidiIterator, Allocator>::operator[] [with BidiIterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Allocator = std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ](((int)i))[j]’
Steven Watanabe-4 wrote:
AMDG
manish4gupta wrote:
I am compiling the program using the following option g++ -ggdb -lboost_regex -o regex regex.cpp but it is giving error.
<snip> for(j = 0; j < what.captures(i).size(); ++j)
<snip>
Error message: regex.cpp: In function ‘void print_captures(const std::string&, const std::string&)’: regex.cpp:20: error: ‘class boost::smatch’ has no member named ‘captures’ regex.cpp:26: error: ‘class boost::smatch’ has no member named ‘captures’
How can i avoid that. Please help me.
There is no function called captures. Use the subscript operator. what[i].size()
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- View this message in context: http://www.nabble.com/How-to-compile-boost-regex-tp25447212p25466226.html Sent from the Boost - Users mailing list archive at Nabble.com.