@@ -642,8 +642,6 @@ template<typename Stream, typename C> void Unserialize(Stream& is, std::basic_st
642
642
* prevector
643
643
* prevectors of unsigned char are a special case and are intended to be serialized as a single opaque blob.
644
644
*/
645
- template <typename Stream, unsigned int N, typename T> void Serialize_impl (Stream& os, const prevector<N, T>& v, const unsigned char &);
646
- template <typename Stream, unsigned int N, typename T, typename V> void Serialize_impl (Stream& os, const prevector<N, T>& v, const V&);
647
645
template <typename Stream, unsigned int N, typename T> inline void Serialize (Stream& os, const prevector<N, T>& v);
648
646
template <typename Stream, unsigned int N, typename T> void Unserialize_impl (Stream& is, prevector<N, T>& v, const unsigned char &);
649
647
template <typename Stream, unsigned int N, typename T, typename V> void Unserialize_impl (Stream& is, prevector<N, T>& v, const V&);
@@ -751,24 +749,16 @@ void Unserialize(Stream& is, std::basic_string<C>& str)
751
749
/* *
752
750
* prevector
753
751
*/
754
- template <typename Stream, unsigned int N, typename T>
755
- void Serialize_impl (Stream& os, const prevector<N, T>& v, const unsigned char &)
756
- {
757
- WriteCompactSize (os, v.size ());
758
- if (!v.empty ())
759
- os.write (MakeByteSpan (v));
760
- }
761
-
762
- template <typename Stream, unsigned int N, typename T, typename V>
763
- void Serialize_impl (Stream& os, const prevector<N, T>& v, const V&)
764
- {
765
- Serialize (os, Using<VectorFormatter<DefaultFormatter>>(v));
766
- }
767
-
768
- template <typename Stream, unsigned int N, typename T>
769
- inline void Serialize (Stream& os, const prevector<N, T>& v)
770
- {
771
- Serialize_impl (os, v, T ());
752
+ template <typename Stream, unsigned int N, typename T>
753
+ void Serialize (Stream& os, const prevector<N, T>& v)
754
+ {
755
+ if constexpr (std::is_same_v<T, unsigned char >) {
756
+ WriteCompactSize (os, v.size ());
757
+ if (!v.empty ())
758
+ os.write (MakeByteSpan (v));
759
+ } else {
760
+ Serialize (os, Using<VectorFormatter<DefaultFormatter>>(v));
761
+ }
772
762
}
773
763
774
764
0 commit comments