| 4 | |
| 5 | namespace { |
| 6 | inline void mid(std::ostream& os, const std::string& str, size_t max_w) { |
| 7 | size_t l = (max_w - str.length()) / 2 + str.length(); |
| 8 | size_t r = max_w - l; |
| 9 | os << std::setw(l) << std::right << str; |
| 10 | if (r > 0) |
| 11 | os << std::setw(r) << ' '; |
| 12 | } |
| 13 | inline size_t char_length(char c) { |
| 14 | return c ? 1 : 0; |
| 15 | } |