Update of /cvsroot/boost/boost/boost/xpressive
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21737

Modified Files:
        regex_compiler.hpp 
Log Message:
avoid accidental regex aliasing

Index: regex_compiler.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/regex_compiler.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- regex_compiler.hpp  5 Mar 2007 02:56:28 -0000       1.9
+++ regex_compiler.hpp  7 Mar 2007 01:21:26 -0000       1.10
@@ -104,11 +104,13 @@
         string_iterator begin = pat.begin(), end = pat.end(), tmp = begin;
 
         // Check if this regex is a named rule:
-        std::string name("__self__");
+        std::string name;
+        basic_regex<BidiIter> rextmp, *prex = &rextmp;
         if(token_group_begin == this->traits_.get_token(tmp, end) &&
            token_rule_assign == this->traits_.get_group_type(tmp, end, name))
         {
             begin = tmp;
+            prex = &this->rules_[name];
             detail::ensure
             (
                 begin != end && token_group_end == 
this->traits_.get_token(begin, end)
@@ -117,8 +119,7 @@
             );
         }
 
-        basic_regex<BidiIter> &rex = this->rules_[name];
-        this->self_ = detail::core_access<BidiIter>::get_regex_impl(rex);
+        this->self_ = detail::core_access<BidiIter>::get_regex_impl(*prex);
 
         // at the top level, a regex is a sequence of alternates
         detail::sequence<BidiIter> seq = this->parse_alternates(begin, end);
@@ -137,7 +138,7 @@
         // References changed, update dependencies.
         this->self_->tracking_update();
         this->self_.reset();
-        return rex;
+        return *prex;
     }
 
 private:


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to