diff options
| author | Alan Conway <aconway@apache.org> | 2009-08-04 19:27:57 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2009-08-04 19:27:57 +0000 |
| commit | 92f8e307ee66bbd4262dee5fc7387954ba2e5d03 (patch) | |
| tree | f060b6ab66e5aafa2cf3c2a7f63a6e2bfd3a6001 /cpp/include | |
| parent | 029f187976c84fdacd6ccc77e3aa008f94caf3b4 (diff) | |
| download | qpid-python-92f8e307ee66bbd4262dee5fc7387954ba2e5d03.tar.gz | |
Explicit Msg::op<< overrides for integral types, fixes a store compile problem.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@800931 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include')
| -rw-r--r-- | cpp/include/qpid/Msg.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/cpp/include/qpid/Msg.h b/cpp/include/qpid/Msg.h index 5149a94d7f..6e08a89571 100644 --- a/cpp/include/qpid/Msg.h +++ b/cpp/include/qpid/Msg.h @@ -43,14 +43,29 @@ struct Msg { Msg(const Msg& m) : os(m.str()) {} std::string str() const { return os.str(); } operator std::string() const { return str(); } + + Msg& operator<<(long n) { os << n; return *this; } + Msg& operator<<(unsigned long n) { os << n; return *this; } + Msg& operator<<(bool n) { os << n; return *this; } + Msg& operator<<(short n) { os << n; return *this; } + Msg& operator<<(unsigned short n) { os << n; return *this; } + Msg& operator<<(int n) { os << n; return *this; } + Msg& operator<<(unsigned int n) { os << n; return *this; } +#ifdef _GLIBCXX_USE_LONG_LONG + Msg& operator<<(long long n) { os << n; return *this; } + Msg& operator<<(unsigned long long n) { os << n; return *this; } +#endif + Msg& operator<<(double n) { os << n; return *this; } + Msg& operator<<(float n) { os << n; return *this; } + Msg& operator<<(long double n) { os << n; return *this; } + + template <class T> Msg& operator<<(const T& t) { os <<t; return *this; } }; -template <class T> const Msg& operator<<(const Msg& m, const T& t) { - const_cast<std::ostringstream&>(m.os)<<t; return m; -} + inline std::ostream& operator<<(std::ostream& o, const Msg& m) { - return o<<m.str(); + return o << m.str(); } /** Construct a message using operator << and append (file:line) */ |
