summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-08-04 19:27:57 +0000
committerAlan Conway <aconway@apache.org>2009-08-04 19:27:57 +0000
commit7d5ae16e63c38e15e316c9b66ee9e1ecdf26b2db (patch)
treed32e02d2bc410d294b75a590049f323d6ed5111c
parent010434f8f32489162ee4a697025994c9872b9b67 (diff)
downloadqpid-python-7d5ae16e63c38e15e316c9b66ee9e1ecdf26b2db.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@800931 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/include/qpid/Msg.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/qpid/cpp/include/qpid/Msg.h b/qpid/cpp/include/qpid/Msg.h
index 5149a94d7f..6e08a89571 100644
--- a/qpid/cpp/include/qpid/Msg.h
+++ b/qpid/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) */