aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/fmt.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/fmt.hh')
-rw-r--r--src/libutil/fmt.hh30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/libutil/fmt.hh b/src/libutil/fmt.hh
index 6e69bdce2..85c0e9429 100644
--- a/src/libutil/fmt.hh
+++ b/src/libutil/fmt.hh
@@ -76,11 +76,11 @@ template <class T>
struct yellowtxt
{
yellowtxt(const T &s) : value(s) {}
- const T &value;
+ const T & value;
};
template <class T>
-std::ostream& operator<<(std::ostream &out, const yellowtxt<T> &y)
+std::ostream & operator<<(std::ostream & out, const yellowtxt<T> & y)
{
return out << ANSI_YELLOW << y.value << ANSI_NORMAL;
}
@@ -88,12 +88,12 @@ std::ostream& operator<<(std::ostream &out, const yellowtxt<T> &y)
template <class T>
struct normaltxt
{
- normaltxt(const T &s) : value(s) {}
- const T &value;
+ normaltxt(const T & s) : value(s) {}
+ const T & value;
};
template <class T>
-std::ostream& operator<<(std::ostream &out, const normaltxt<T> &y)
+std::ostream & operator<<(std::ostream & out, const normaltxt<T> & y)
{
return out << ANSI_NORMAL << y.value;
}
@@ -101,26 +101,30 @@ std::ostream& operator<<(std::ostream &out, const normaltxt<T> &y)
class hintformat
{
public:
- hintformat(const string &format) :fmt(format)
+ hintformat(const string & format) : fmt(format)
{
- fmt.exceptions(boost::io::all_error_bits ^
+ fmt.exceptions(boost::io::all_error_bits ^
boost::io::too_many_args_bit ^
boost::io::too_few_args_bit);
}
- hintformat(const hintformat &hf)
- : fmt(hf.fmt)
- {}
+ hintformat(const hintformat & hf)
+ : fmt(hf.fmt)
+ { }
+
+ hintformat(format && fmt)
+ : fmt(std::move(fmt))
+ { }
template<class T>
- hintformat& operator%(const T &value)
+ hintformat & operator%(const T & value)
{
fmt % yellowtxt(value);
return *this;
}
template<class T>
- hintformat& operator%(const normaltxt<T> &value)
+ hintformat & operator%(const normaltxt<T> & value)
{
fmt % value.value;
return *this;
@@ -135,7 +139,7 @@ private:
format fmt;
};
-std::ostream& operator<<(std::ostream &os, const hintformat &hf);
+std::ostream & operator<<(std::ostream & os, const hintformat & hf);
template<typename... Args>
inline hintformat hintfmt(const std::string & fs, const Args & ... args)