]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Surround substituted tokens by spaces to avoid the problem with '>>' ending template...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 2 Dec 2007 05:00:22 +0000 (05:00 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 2 Dec 2007 05:00:22 +0000 (05:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@15568 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/common/scripts/expand_instantiations.cc

index bad978db628aabec663e65ba2193db5580d4336f..d6714344ffee909ee537a3fb32a85b1c9bd14cc3 100644 (file)
@@ -174,7 +174,10 @@ bool is_real_token (const std::string &text,
 }
 
 
-// substitute all occurrences of #token in #text by #substitute
+// substitute all occurrences of #token in #text by #substitute. because a
+// replacement token could be a templated class like std::complex<double> and
+// because the token to the substituted may be a template argument itself, we
+// surround the substitution by a space which shouldn't matter in C++
 std::string substitute_tokens (const std::string &text,
                               const std::string &token,
                               const std::string &substitute)
@@ -185,8 +188,9 @@ std::string substitute_tokens (const std::string &text,
     {
       if (is_real_token (x_text, pos, token.size()))
        {  
-         x_text.replace (pos, token.size(), substitute);
-         pos += substitute.size();
+         x_text.replace (pos, token.size(),
+                         std::string(" ")+substitute+std::string(" "));
+         pos += substitute.size()+2;
        }
       else
        ++pos;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.