Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2001-10-09 07:07:59


Hi,

Is the following legal for regex?

const char* data = ...;
const size_t length = ...;
boost::cmatch what
if( boost::regex_match( std::string( data, length ), what ) {
  ...
  cout << what[ 1 ] << endl;
}

The problem is that I pass a temporary object and AFAICS 'what' only
stores a reference (iterator?) to the source. When accessing what[ 1 ],
the data is no longer valid. Should this be documented (I haven't found
anything in the docs) or should the implementation be fixed? It seems to
me that this is a very dangerous interface as nothing in the above code
looks 'suspicious'. Or am I missing something?

Regards, Daniel

--
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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