@@ -40,14 +40,16 @@ template <typename T>
4040typename std::enable_if<ext_traits::is_back_insertable<T>::value,void >::type
4141read_typed_array (jsoncons::span<uint8_t > typed_array, typed_array_element_type element_type, T& v)
4242{
43+ using value_type = typename T::value_type;
44+
4345 switch (element_type)
4446 {
4547 case typed_array_element_type::uint8:
4648 {
4749 auto ta = typed_array_cast<const uint8_t >(typed_array);
4850 for (auto item : ta)
4951 {
50- v.push_back (item);
52+ v.push_back (static_cast <value_type>( item) );
5153 }
5254 break ;
5355 }
@@ -56,7 +58,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
5658 auto ta = typed_array_cast<const uint16_t >(typed_array);
5759 for (auto item : ta)
5860 {
59- v.push_back (item);
61+ v.push_back (static_cast <value_type>( item) );
6062 }
6163 break ;
6264 }
@@ -65,7 +67,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
6567 auto ta = typed_array_cast<const uint32_t >(typed_array);
6668 for (auto item : ta)
6769 {
68- v.push_back (item);
70+ v.push_back (static_cast <value_type>( item) );
6971 }
7072 break ;
7173 }
@@ -74,7 +76,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
7476 auto ta = typed_array_cast<const uint64_t >(typed_array);
7577 for (auto item : ta)
7678 {
77- v.push_back (item);
79+ v.push_back (static_cast <value_type>( item) );
7880 }
7981 break ;
8082 }
@@ -83,7 +85,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
8385 auto ta = typed_array_cast<const int8_t >(typed_array);
8486 for (auto item : ta)
8587 {
86- v.push_back (item);
88+ v.push_back (static_cast <value_type>( item) );
8789 }
8890 break ;
8991 }
@@ -92,7 +94,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
9294 auto ta = typed_array_cast<const int16_t >(typed_array);
9395 for (auto item : ta)
9496 {
95- v.push_back (item);
97+ v.push_back (static_cast <value_type>( item) );
9698 }
9799 break ;
98100 }
@@ -101,7 +103,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
101103 auto ta = typed_array_cast<const int32_t >(typed_array);
102104 for (auto item : ta)
103105 {
104- v.push_back (item);
106+ v.push_back (static_cast <value_type>( item) );
105107 }
106108 break ;
107109 }
@@ -110,7 +112,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
110112 auto ta = typed_array_cast<const int64_t >(typed_array);
111113 for (auto item : ta)
112114 {
113- v.push_back (item);
115+ v.push_back (static_cast <value_type>( item) );
114116 }
115117 break ;
116118 }
@@ -119,7 +121,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
119121 auto ta = typed_array_cast<const int16_t >(typed_array);
120122 for (auto item : ta)
121123 {
122- v.push_back (item);
124+ v.push_back (static_cast <value_type>( item) );
123125 }
124126 break ;
125127 }
@@ -128,7 +130,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
128130 auto ta = typed_array_cast<const float >(typed_array);
129131 for (auto item : ta)
130132 {
131- v.push_back (item);
133+ v.push_back (static_cast <value_type>( item) );
132134 }
133135 break ;
134136 }
@@ -137,7 +139,7 @@ read_typed_array(jsoncons::span<uint8_t> typed_array, typed_array_element_type e
137139 auto ta = typed_array_cast<const double >(typed_array);
138140 for (auto item : ta)
139141 {
140- v.push_back (item);
142+ v.push_back (static_cast <value_type>( item) );
141143 }
142144 break ;
143145 }
0 commit comments