64,637
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <boost/xpressive/xpressive.hpp>
using namespace boost::xpressive;
int main()
{
std::string hello( "hello world!" );
sregex rex = sregex::compile( "(\\w+) (\\w+)!" );
smatch what;
if( regex_match( hello, what, rex ) )
{
std::cout << what[0] << '\n'; // whole match
std::cout << what[1] << '\n'; // first capture
std::cout << what[2] << '\n'; // second capture
}
return 0;
}
c:\windriver\gnu\3.4.4-vxworks-6.4\x86-win32\bin\../lib/gcc/powerpc-wrs-vxworks/3.4.4/../../../../include/c++/3.4.4/vector: In member function `void std::vector<_Ty, _Ax>::_Insert_n(std::vector<_Ty, _
Ax>::iterator, typename std::_Vector_val<_Ty, _Ax>::_Alty::size_type, const _Ty&) [with _Ty = boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<
char> >::const_iterator>, _Ax = std::allocator<boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator> >]':
c:\windriver\gnu\3.4.4-vxworks-6.4\x86-win32\bin\../lib/gcc/powerpc-wrs-vxworks/3.4.4/../../../../include/c++/3.4.4/vector:719: instantiated from `std::vector<_Ty, _Ax>::iterator std::vector<_Ty, _A
x>::insert(std::vector<_Ty, _Ax>::iterator, const _Ty&) [with _Ty = boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator>,
_Ax = std::allocator<boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator> >]'
c:\windriver\gnu\3.4.4-vxworks-6.4\x86-win32\bin\../lib/gcc/powerpc-wrs-vxworks/3.4.4/../../../../include/c++/3.4.4/vector:665: instantiated from `void std::vector<_Ty, _Ax>::push_back(const _Ty&) [
with _Ty = boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator>, _Ax = std::allocator<boost::xpressive::detail::shared_mat
chable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator> >]'
D:/code/boost_1_46_1/boost/xpressive/detail/dynamic/sequence.hpp:112: instantiated from `boost::xpressive::detail::sequence<BidiIter>& boost::xpressive::detail::sequence<BidiIter>::operator|=(boost:
:xpressive::detail::sequence<BidiIter>) [with BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:287: instantiated from `boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::
parse_alternates(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator, RegexTraits = boost::xpressive::rege
x_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:212: instantiated from `boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compi
le_(FwdIter, FwdIter, boost::xpressive::regex_constants::syntax_option_type, std::forward_iterator_tag) [with FwdIter = const char*, BidiIter = std::basic_string<char, std::char_traits<char>, std::all
ocator<char> >::const_iterator, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::rege
x_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:120: instantiated from `boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compi
le(InputIter, InputIter, boost::xpressive::regex_constants::syntax_option_type) [with InputIter = const char*, BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_
iterator, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::
xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:139: instantiated from `boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compi
le(const typename boost::iterator_value<Iterator>::type*, boost::xpressive::regex_constants::syntax_option_type) [with BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >
::const_iterator, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char,
boost::xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/basic_regex.hpp:200: instantiated from `static boost::xpressive::basic_regex<BidiIter> boost::xpressive::basic_regex<BidiIter>::compile(const typename boost::ite
rator_value<Iterator>::type*, boost::xpressive::regex_constants::syntax_option_type) [with BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator]'
testBoost.cpp:13: instantiated from here
D:/code/boost_1_46_1/boost/xpressive/detail/utility/sequence_stack.hpp:24: error: `boost::xpressive::detail::fill' is not a function,
c:\windriver\gnu\3.4.4-vxworks-6.4\x86-win32\bin\../lib/gcc/powerpc-wrs-vxworks/3.4.4/../../../../include/c++/3.4.4/xutility:1661: error: conflict with `void std::fill(unsigned char*, unsigned char*
, int)'
c:\windriver\gnu\3.4.4-vxworks-6.4\x86-win32\bin\../lib/gcc/powerpc-wrs-vxworks/3.4.4/../../../../include/c++/3.4.4/vector:1039: error: in call to `fill'
c:\windriver\gnu\3.4.4-vxworks-6.4\x86-win32\bin\../lib/gcc/powerpc-wrs-vxworks/3.4.4/../../../../include/c++/3.4.4/vector:719: instantiated from `std::vector<_Ty, _Ax>::iterator std::vector<_Ty, _A
x>::insert(std::vector<_Ty, _Ax>::iterator, const _Ty&) [with _Ty = boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator>,
_Ax = std::allocator<boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator> >]'
c:\windriver\gnu\3.4.4-vxworks-6.4\x86-win32\bin\../lib/gcc/powerpc-wrs-vxworks/3.4.4/../../../../include/c++/3.4.4/vector:665: instantiated from `void std::vector<_Ty, _Ax>::push_back(const _Ty&) [
with _Ty = boost::xpressive::detail::shared_matchable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator>, _Ax = std::allocator<boost::xpressive::detail::shared_mat
chable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator> >]'
D:/code/boost_1_46_1/boost/xpressive/detail/dynamic/sequence.hpp:112: instantiated from `boost::xpressive::detail::sequence<BidiIter>& boost::xpressive::detail::sequence<BidiIter>::operator|=(boost:
:xpressive::detail::sequence<BidiIter>) [with BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:287: instantiated from `boost::xpressive::detail::sequence<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::
parse_alternates(FwdIter&, FwdIter) [with FwdIter = const char*, BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator, RegexTraits = boost::xpressive::rege
x_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:212: instantiated from `boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compi
le_(FwdIter, FwdIter, boost::xpressive::regex_constants::syntax_option_type, std::forward_iterator_tag) [with FwdIter = const char*, BidiIter = std::basic_string<char, std::char_traits<char>, std::all
ocator<char> >::const_iterator, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::rege
x_traits<char, boost::xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:120: instantiated from `boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compi
le(InputIter, InputIter, boost::xpressive::regex_constants::syntax_option_type) [with InputIter = const char*, BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_
iterator, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char, boost::
xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/regex_compiler.hpp:139: instantiated from `boost::xpressive::basic_regex<BidiIter> boost::xpressive::regex_compiler<BidiIter, RegexTraits, CompilerTraits>::compi
le(const typename boost::iterator_value<Iterator>::type*, boost::xpressive::regex_constants::syntax_option_type) [with BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >
::const_iterator, RegexTraits = boost::xpressive::regex_traits<char, boost::xpressive::cpp_regex_traits<char> >, CompilerTraits = boost::xpressive::compiler_traits<boost::xpressive::regex_traits<char,
boost::xpressive::cpp_regex_traits<char> > >]'
D:/code/boost_1_46_1/boost/xpressive/basic_regex.hpp:200: instantiated from `static boost::xpressive::basic_regex<BidiIter> boost::xpressive::basic_regex<BidiIter>::compile(const typename boost::ite
rator_value<Iterator>::type*, boost::xpressive::regex_constants::syntax_option_type) [with BidiIter = std::basic_string<char, std::char_traits<char>, std::allocator<char> >::const_iterator]'