diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-04-01 06:05:53 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:14:36 +0300 |
commit | 06c612827e830562514452e9b79b4bc3a7c8863b (patch) | |
tree | b773fbba9f7220a253026670b5aeb24532424ca2 /coding/streams_sink.hpp | |
parent | 454c6d0afeca9406b93a8088f5591228f24a4821 (diff) |
Added serialization code for m2::Rect, m2::Point and m2::Region
Diffstat (limited to 'coding/streams_sink.hpp')
-rw-r--r-- | coding/streams_sink.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/coding/streams_sink.hpp b/coding/streams_sink.hpp index 85f7dc22ad..23ecad90f3 100644 --- a/coding/streams_sink.hpp +++ b/coding/streams_sink.hpp @@ -61,6 +61,14 @@ namespace stream detail::ReadString(*this, t); return *this; } + + SinkReaderStream & operator >> (double & t) + { + STATIC_ASSERT(sizeof(double) == sizeof(int64_t)); + operator>>(reinterpret_cast<int64_t &>(t)); + return *this; + } + }; template <class TWriter> class SinkWriterStream @@ -118,5 +126,13 @@ namespace stream return *this; } + SinkWriterStream & operator << (double t) + { + STATIC_ASSERT(sizeof(double) == sizeof(int64_t)); + int64_t tInt = *reinterpret_cast<int64_t const *>(&t); + operator<<(tInt); + return (*this); + } + }; } |