@@ -375,18 +375,18 @@ struct vector_has_data_and_format : std::false_type {};
375
375
template <typename Vector>
376
376
struct vector_has_data_and_format <Vector, enable_if_t <std::is_same<decltype(format_descriptor<typename Vector::value_type>::format(), std::declval<Vector>().data()), typename Vector::value_type*>::value>> : std::true_type {};
377
377
378
- // Add the buffer interface to a vector
379
- template <typename Vector, typename Class_, typename ... Args>
380
- #if defined(__INTEL_COMPILER) && defined(PYBIND11_CPP17)
381
378
// [workaround(intel)] Separate function required here
382
379
// Workaround as the Intel compiler does not compile the enable_if_t part below
383
380
// (tested with icc (ICC) 2021.1 Beta 20200827)
384
- void vector_buffer (Class_& cl) {
385
- if constexpr (detail::any_of<std::is_same<Args, buffer_protocol>...>::value) {
386
- #else
387
- enable_if_t <detail::any_of<std::is_same<Args, buffer_protocol>...>::value>
381
+ template <typename ... Args>
382
+ constexpr bool args_any_are_buffer () {
383
+ return detail::any_of<std::is_same<Args, buffer_protocol>...>::value;
384
+ }
385
+
386
+ // Add the buffer interface to a vector
387
+ template <typename Vector, typename Class_, typename ... Args>
388
+ enable_if_t <args_any_are_buffer<Args...>()>
388
389
vector_buffer (Class_& cl) {
389
- #endif
390
390
using T = typename Vector::value_type;
391
391
392
392
static_assert (vector_has_data_and_format<Vector>::value, " There is not an appropriate format descriptor for this vector" );
@@ -421,16 +421,11 @@ vector_buffer(Class_& cl) {
421
421
}));
422
422
423
423
return ;
424
- #if defined(__INTEL_COMPILER) && defined(PYBIND11_CPP17)
425
- }
426
- }
427
- #else
428
424
}
429
425
430
426
template <typename Vector, typename Class_, typename ... Args>
431
- enable_if_t <!detail::any_of<std::is_same< Args, buffer_protocol> ...>::value > vector_buffer (Class_&) {}
427
+ enable_if_t <!args_any_are_buffer< Args...>() > vector_buffer (Class_&) {}
432
428
433
- #endif
434
429
435
430
PYBIND11_NAMESPACE_END (detail)
436
431
0 commit comments