]> https://gitweb.dealii.org/ - dealii.git/commit
Avoid where possible to use std::ostringstream to generate filenames. 5945/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 22 Feb 2018 05:39:39 +0000 (22:39 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 22 Feb 2018 15:27:06 +0000 (08:27 -0700)
commitda507ffc90bd6519321189dae69d81cfebc41a79
treeccf6b79c4fb99639888ed44c687867dae66cad78
parent8a320d43023dca33b9dfd0133e94bc9e87131e96
Avoid where possible to use std::ostringstream to generate filenames.

To students, this seems like an unnecessary detour. This may have been useful in
olden times, but we now have helper functions to convert numbers to text without
having to create a std::ostringstream in user code, and we also have std::to_string().

Finally, this avoids the awkward idiom
  std::ostringstream filename;
  ...
  std::ofstream output (filename.str().c_str());
where we have to call .str().c_str().

Instead of this, just create the filename in place and be done with it.
14 files changed:
examples/step-13/step-13.cc
examples/step-14/step-14.cc
examples/step-16/step-16.cc
examples/step-17/step-17.cc
examples/step-21/step-21.cc
examples/step-22/step-22.cc
examples/step-31/step-31.cc
examples/step-37/step-37.cc
examples/step-44/step-44.cc
examples/step-45/step-45.cc
examples/step-46/step-46.cc
examples/step-5/step-5.cc
examples/step-56/step-56.cc
examples/step-57/step-57.cc

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.