Improve invocation APIs and facilities to define an operator dispatch #106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
pro::proxy::invoke()
out of the scope of class templateproxy
as a free function templatepro::proxy_invoke()
.pro::proxy::reflect()
out of the scope of class templateproxy
as a free function templatepro::proxy_reflect()
.pro::lazy_eval()
since it is no longer needed.pro::lazy_eval_t
into namespacepro::details
since it is not required with the "deducing this" feature in C++23 (it is discouraged for custom implementations of a dispatch to use something likelazy_eval_t
when the language feature is implemented by a compiler).Note that
PRO_DEF_OPERATOR_DISPATCH()
may not cover ALL forms of expressions with the given operator. For example, for an operanda
, the plus sign+
supports both prefix (+a
,x + a
) and postfix (a + x
) forms.PRO_DEF_OPERATOR_DISPATCH()
will only define the either prefix or the postfix (preferred) form when an operator supports both forms. People can explicitly choose whether an operator dispatch supports prefix or postfix form by usingPRO_DEF_PRE_OPERATOR_DISPATCH()
orPRO_DEF_POST_OPERATOR_DISPATCH()
. The_WITH_DEFAULT
version of the 3 macros allows implementations to provide additional default procedure if the operator is not applicable, similar withPRO_DEF_MEM_DISPATCH()
andPRO_DEF_FREE_DISAPTCH()
.Throughout the C++ standards, there are currently 45 different signs of operators (different operators may share the same sign, like
*
and&
). The following 37 has been fully implemented in this change:The following 5 are context-dependent and not applicable for
proxy
:The other 3 are not applicable:
=
) is ambiguous in the context ofproxy
and therefore not implemented;""
) only works for a limited number of primitive types and not applicable forproxy
;operator->*()
is used to access a member of an object through a pointer, which is considered to be implemented in later changes.README.md
to reflect the new syntax. Closes Update README.md to reflect the new syntax to build a facade #104