-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFINAE callability check, more algorithm categories, reducing allocations #3
Comments
Regarding the "The continuation does not check if the algorithm is applicable to the container" issue: The error using g++ is: algorithm.hpp: In instantiation of ‘auto operator|(C&&, F) [with C = int; F = _MM_MANTISSA_NORM_ENUM]’: This only applies for compiling with optimization (O1, O2, or O3) Compiler information: COLLECT_GCC=g++ |
Seems like we are overriding bitwise or by making the pipe operator an unconstrained template. I can add a is_function or is_callable as you suggested, but this is behavior correct? I'm not that sure. In theory function overloads are above templates in name lookup rules, so the correct bitwise operator should match first. This deserves a question in SO. |
Regarding the new algorithm category for filter-like algorithms: With continuations we never actually want a new object. Stuff like copy_if works with |
The bug with gcc is certainly a nasty one. Even if it's a bug in gcc, I'd go with sfinae-enabling the method OR adding a nice and shiny static_assert. |
You can also use a trailing template<typename C, typename F>
auto operator|(C&& container, F f) -> decltype(f(std::forward<C>(container)))
{
return f(std::forward<C>(container));
} Also the |
Stefan Löerwald sent me an email referencing some issues:
algorithm_category(std::transform, snail::categories::binary_mutable_inplace)
TL;DR
In brief, he points out some issues the library currently has:
Besides that, I don't understand "With gcc, I get compiler errors in the
operator|(C&&, F)
. This is due to matches to this operator with non-callable F in some internal compiler headers". The library is being tested on Travis CI with GCC compiler. Maybe he's using a previous version.snail::categories::binary_mutable_inplace
category to reduce unnecessary container allocations: Totally agree, adding more categories covering specific cases to improve performance is something I have to do. The current set of categories serves as a proof of concept, but it's too generic.The text was updated successfully, but these errors were encountered: