From 5c1767344367704a346bea15826a0268d1cc3e58 Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 2 Dec 2007 05:00:22 +0000 Subject: [PATCH] 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 --- deal.II/common/scripts/expand_instantiations.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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; -- 2.39.5