Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2004-04-22 05:18:05


> I tried your suggestion, and it appears that I still have the same errors.
> Anyone have any other ideas?

Yes, I didn't spot your other error: the type boost::cmatch is typedef'ed
as:

typedef match_results<const char*> cmatch;

But you're not searching a const char*, you're searching a
std::string::const_iterator (the two are the same type on VC6, but not on
VC7 and later), so the typedef:

typedef match_results<std::string::const_iterator> smatch;

is the right one to use, here's the corrected code:

int main(int argc, char* argv[])
{
std::string m_rBuffer;
boost::regex m_rStartExp;

std::string::const_iterator rRawDataBegin = m_rBuffer.begin();
std::string::const_iterator rRawDataEnd = m_rBuffer.end();
boost::smatch rStartMessage;
boost::match_flag_type flags = boost::match_default;

while ( boost::regex_search(rRawDataBegin,
rRawDataEnd,
rStartMessage,
m_rStartExp,
flags) )
{
rRawDataBegin = rStartMessage[0].first;
}
}

John


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