diff options
Diffstat (limited to 'cpp/src/qpid/Serializer.h')
-rw-r--r-- | cpp/src/qpid/Serializer.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cpp/src/qpid/Serializer.h b/cpp/src/qpid/Serializer.h index e0e29e24fd..12bcded0f7 100644 --- a/cpp/src/qpid/Serializer.h +++ b/cpp/src/qpid/Serializer.h @@ -28,6 +28,16 @@ namespace qpid { namespace serialize { +/** Wrapper to pass serializer functors by reference. */ +template <class S> struct SRef { + S& s; + SRef(S& ss) : s(ss) {} + template <class T> typename S::result_type operator()(T& x) { return s(x); } + template <class T> typename S::result_type operator()(const T& x) { return s(x); } +}; + +template <class S> SRef<S> ref(S& s) { return SRef<S>(s); } + // FIXME aconway 2008-03-03: Document. // Encoder/Decoder concept: add op() for primitive types, raw(), // op()(Iter, Iter). Note split, encode, decode. |