Tag Archive: stl


If you use boost::regex, don’t do what I just did.

  1. Calling boost::regex_match(std::string&,match_results&,basic_regex&)
  2. Changing the std::string that was passed to regex_match.
  3. Trying to look at the sub-matches in the match_results object.

I didn’t realize that match_results kept references to the string, and so you can’t edit the string.

Perhaps that will save someone from hitting an assert().

Perhaps it is a sign that I need to find a hobby, or perhaps it is just jitters from starting a new job in a new programming language; but I woke up in the middle of the night dreaming about safe ways to write copy constructors when some of the member variables are using std::auto_ptr<>.