@@ -188,6 +188,7 @@ template<typename X> const X& ReadWriteAsHelper(const X& x) { return x; }
188
188
} \
189
189
FORMATTER_METHODS (cls, obj)
190
190
191
+ // clang-format off
191
192
#ifndef CHAR_EQUALS_INT8
192
193
template <typename Stream> void Serialize (Stream&, char ) = delete; // char serialization forbidden. Use uint8_t or int8_t
193
194
#endif
@@ -201,8 +202,7 @@ template<typename Stream> inline void Serialize(Stream& s, int64_t a ) { ser_wri
201
202
template <typename Stream> inline void Serialize (Stream& s, uint64_t a) { ser_writedata64 (s, a); }
202
203
template <typename Stream, int N> inline void Serialize (Stream& s, const char (&a)[N]) { s.write (MakeByteSpan (a)); }
203
204
template <typename Stream, int N> inline void Serialize (Stream& s, const unsigned char (&a)[N]) { s.write (MakeByteSpan (a)); }
204
- template <typename Stream> inline void Serialize (Stream& s, const Span<const unsigned char >& span) { s.write (AsBytes (span)); }
205
- template <typename Stream> inline void Serialize (Stream& s, const Span<unsigned char >& span) { s.write (AsBytes (span)); }
205
+ template <typename Stream, typename B> void Serialize (Stream& s, Span<B> span) { (void )/* force byte-type */ UCharCast (span.data ()); s.write (AsBytes (span)); }
206
206
207
207
#ifndef CHAR_EQUALS_INT8
208
208
template <typename Stream> void Unserialize (Stream&, char ) = delete; // char serialization forbidden. Use uint8_t or int8_t
@@ -217,10 +217,11 @@ template<typename Stream> inline void Unserialize(Stream& s, int64_t& a ) { a =
217
217
template <typename Stream> inline void Unserialize (Stream& s, uint64_t & a) { a = ser_readdata64 (s); }
218
218
template <typename Stream, int N> inline void Unserialize (Stream& s, char (&a)[N]) { s.read (MakeWritableByteSpan (a)); }
219
219
template <typename Stream, int N> inline void Unserialize (Stream& s, unsigned char (&a)[N]) { s.read (MakeWritableByteSpan (a)); }
220
- template <typename Stream> inline void Unserialize (Stream& s, Span<unsigned char >& span) { s.read (AsWritableBytes (span)); }
220
+ template <typename Stream, typename B> void Unserialize (Stream& s, Span<B> span) { ( void ) /* force byte-type */ UCharCast (span. data ()); s.read (AsWritableBytes (span)); }
221
221
222
222
template <typename Stream> inline void Serialize (Stream& s, bool a) { uint8_t f = a; ser_writedata8 (s, f); }
223
223
template <typename Stream> inline void Unserialize (Stream& s, bool & a) { uint8_t f = ser_readdata8 (s); a = f; }
224
+ // clang-format on
224
225
225
226
226
227
/* *
0 commit comments