-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Intel ICC C++17 compatibility #2729
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -375,10 +375,20 @@ struct vector_has_data_and_format : std::false_type {}; | |
template <typename Vector> | ||
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 {}; | ||
|
||
// [workaround(intel)] Separate function required here | ||
// Workaround as the Intel compiler does not compile the enable_if_t part below | ||
mkuron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// (tested with icc (ICC) 2021.1 Beta 20200827) | ||
template <typename... Args> | ||
constexpr bool args_any_are_buffer() { | ||
return detail::any_of<std::is_same<Args, buffer_protocol>...>::value; | ||
} | ||
|
||
// [workaround(intel)] Separate function required here | ||
// [workaround(msvc)] Can't use constexpr bool in return type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is MSVC failing on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original all-in-one was too complicated for ICC to compile. Refactoring it to match the others, with a constexpr function, confused MSVC if it was in the return type. This is simpler to compile and avoids a constexpr function in a return type. As I don't think that this function is an external interface, and it's only used here, I could avoid the intermediate function and call the "impl" style function directly, if that's seen as cleaner. |
||
|
||
// Add the buffer interface to a vector | ||
template <typename Vector, typename Class_, typename... Args> | ||
enable_if_t<detail::any_of<std::is_same<Args, buffer_protocol>...>::value> | ||
vector_buffer(Class_& cl) { | ||
void vector_buffer_impl(Class_& cl, std::true_type) { | ||
using T = typename Vector::value_type; | ||
|
||
static_assert(vector_has_data_and_format<Vector>::value, "There is not an appropriate format descriptor for this vector"); | ||
|
@@ -416,7 +426,12 @@ vector_buffer(Class_& cl) { | |
} | ||
|
||
template <typename Vector, typename Class_, typename... Args> | ||
enable_if_t<!detail::any_of<std::is_same<Args, buffer_protocol>...>::value> vector_buffer(Class_&) {} | ||
void vector_buffer_impl(Class_&, std::false_type) {} | ||
|
||
template <typename Vector, typename Class_, typename... Args> | ||
void vector_buffer(Class_& cl) { | ||
vector_buffer_impl<Vector, Class_, Args...>(cl, detail::any_of<std::is_same<Args, buffer_protocol>...>{}); | ||
} | ||
|
||
PYBIND11_NAMESPACE_END(detail) | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.