asio-tr2 icon indicating copy to clipboard operation
asio-tr2 copied to clipboard

Remove is_executor

Open chriskohlhoff opened this issue 10 years ago • 1 comments

We will look at using SFINAE or similar at each place where it is used to branch code.

chriskohlhoff avatar Feb 24 '15 10:02 chriskohlhoff

Pre-Lenexa Summary

[async.is.exec]

The comment in Cologne was that specialising this trait for user-defined executor types is an unnecessary burden. The trait is used to distinguish between overloads that take an execution context and an executor. The proposal made at the time was that these functions should simply use SFINAE conditions that are inversions of each other, e.g.:

Remarks This function shall not participate in overload resolution unless is_convertible<ExecutionContext&, execution_context&>::value is true.

and

Remarks This function shall not participate in overload resolution unless is_convertible<Executor&, execution_context&>::value is false.

In trying to implement this change I found that there are some cases that don't fit this pattern. For example, the single-argument overloads of make_work. For these overloads, an is_executor trait is still required.

I propose keeping the trait but have it automatically evaluate to true_type if the template parameter meets the syntactic requirements for an Executor. This approach is already used for the buffer-related traits.

chriskohlhoff avatar May 04 '15 12:05 chriskohlhoff