@@ -224,60 +224,26 @@ namespace xsimd
224224 **************************/
225225
226226 template <class T >
227- struct comp_return_type_impl ;
228-
229- template <>
230- struct comp_return_type_impl <uint8x16_t >
231- {
232- using type = uint8x16_t ;
233- };
234-
235- template <>
236- struct comp_return_type_impl <int8x16_t >
237- {
238- using type = uint8x16_t ;
239- };
240-
241- template <>
242- struct comp_return_type_impl <uint16x8_t >
243- {
244- using type = uint16x8_t ;
245- };
246-
247- template <>
248- struct comp_return_type_impl <int16x8_t >
249- {
250- using type = uint16x8_t ;
251- };
252-
253- template <>
254- struct comp_return_type_impl <uint32x4_t >
255- {
256- using type = uint32x4_t ;
257- };
258-
259- template <>
260- struct comp_return_type_impl <int32x4_t >
261- {
262- using type = uint32x4_t ;
263- };
264-
265- template <>
266- struct comp_return_type_impl <uint64x2_t >
267- {
268- using type = uint64x2_t ;
269- };
270-
271- template <>
272- struct comp_return_type_impl <int64x2_t >
273- {
274- using type = uint64x2_t ;
275- };
276-
277- template <>
278- struct comp_return_type_impl <float32x4_t >
279- {
280- using type = uint32x4_t ;
227+ struct comp_return_type_impl
228+ {
229+ // Annoyingly long chain of std::conditional.
230+ // On MSVC, all integer vector type point to the same type, making
231+ // hard to work with template specialization.
232+ // TODO(C++17): the type could be deduced as the return type of a
233+ // function with multiple `if constexpr` (more readable).
234+ using type = typename std::conditional<
235+ std::is_same<T, uint8x16_t >::value || std::is_same<T, int8x16_t >::value,
236+ uint8x16_t ,
237+ typename std::conditional<
238+ std::is_same<T, uint16x8_t >::value || std::is_same<T, int16x8_t >::value,
239+ uint16x8_t ,
240+ typename std::conditional<
241+ std::is_same<T, uint32x4_t >::value || std::is_same<T, int32x4_t >::value || std::is_same<T, float32x4_t >::value,
242+ uint32x4_t ,
243+ typename std::conditional<
244+ std::is_same<T, uint64x2_t >::value || std::is_same<T, int64x2_t >::value,
245+ uint64x2_t ,
246+ T>::type>::type>::type>::type;
281247 };
282248
283249 template <class T >
0 commit comments