From: Wolfgang Bangerth Date: Sun, 2 Dec 2007 05:00:22 +0000 (+0000) Subject: Surround substituted tokens by spaces to avoid the problem with '>>' ending template... X-Git-Tag: v8.0.0~9574 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcf8f9040306cfe509440c448ed63b335a91a0b0;p=dealii.git Surround substituted tokens by spaces to avoid the problem with '>>' ending template arguments. git-svn-id: https://svn.dealii.org/trunk@15568 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/common/scripts/expand_instantiations.cc b/deal.II/common/scripts/expand_instantiations.cc index bad978db62..d6714344ff 100644 --- a/deal.II/common/scripts/expand_instantiations.cc +++ b/deal.II/common/scripts/expand_instantiations.cc @@ -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 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;