Skip to content

Restrict operator accessors to the supported numbers of parameters - #103

Merged
mingxwa merged 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/operator-access-arity
Nov 15, 2026
Merged

mingxwa merged 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/operator-access-arity

Conversation

@mingxwa

@mingxwa mingxwa commented Nov 15, 2026

Copy link
Copy Markdown
Member
  • Restricted the accessors of the binary operators to one parameter and those of "+", "-", "*" and "&" to none or one. An overload with another number of parameters generated an invalid operator function and failed to compile, instead of providing no accessor.
  • Restricted the accessor of "[]" to one parameter unless the implementation supports multidimensional subscripts, matching operator_dispatch<"[]">.
  • Added tests for unsupported numbers of parameters, alone and combined with supported overloads.
  • Regrouped the accessor specializations of operator_access by the number of parameters each operator supports.
  • Corrected the C++23 labels of the "[]" call operators of operator_dispatch and added the missing "%=" to its lists.

- Restricted the accessors of the binary operators to one parameter and those of `"+"`, `"-"`, `"*"` and `"&"` to none or one. An overload with another number of parameters generated an invalid operator function and failed to compile, instead of providing no accessor.
- Restricted the accessor of `"[]"` to one parameter unless the implementation supports multidimensional subscripts, matching `operator_dispatch<"[]">`.
- Added tests for unsupported numbers of parameters, alone and combined with supported overloads.
- Regrouped the accessor specializations of `operator_access` by the number of parameters each operator supports.
- Corrected the C++23 labels of the `"[]"` call operators of `operator_dispatch` and added the missing `"%="` to its lists.
@mingxwa
mingxwa merged commit 38f3cc8 into ngcpp:feature/v5 Nov 15, 2026
20 checks passed
@mingxwa
mingxwa deleted the user/mingxwa/operator-access-arity branch November 15, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant