Version: SMASH-3.1
iomanipulators.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2014-2015,2017-2018,2020
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_IOMANIPULATORS_H_
11 #define SRC_INCLUDE_SMASH_IOMANIPULATORS_H_
12 
13 #include <ostream>
14 
15 namespace smash {
16 
29 template <int w = 9, int p = w - 3, typename CharT, typename Traits>
30 inline std::basic_ostream<CharT, Traits> &field(
31  std::basic_ostream<CharT, Traits> &s) {
32  s.put(s.widen(' '));
33  s.setf(std::ios_base::fixed, std::ios_base::floatfield);
34  s.width(w);
35  s.precision(p);
36  return s;
37 }
38 
39 } // namespace smash
40 
41 #endif // SRC_INCLUDE_SMASH_IOMANIPULATORS_H_
std::basic_ostream< CharT, Traits > & field(std::basic_ostream< CharT, Traits > &s)
Stream modifier to align the next object to a specific width w.
constexpr int p
Proton.
Definition: action.h:24