Extend operator support - #282
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #282 +/- ##
==========================================
+ Coverage 72.87% 72.95% +0.08%
==========================================
Files 9 9
Lines 822 832 +10
Branches 208 208
==========================================
+ Hits 599 607 +8
- Misses 24 25 +1
- Partials 199 200 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| // <source-name> for its identifier otherwise. `identifier_of` throws for | ||
| // `operator()`, which has no identifier. | ||
| // <operator-name> for a supported operator function, or a length-prefixed | ||
| // <source-name> for its identifier otherwise. `identifier_of` throws for an |
There was a problem hiding this comment.
Rephrase "identifier_of` throws for an operator function, which has no identifier."
| consteval bool same_name(std::meta::info a, std::meta::info b) { | ||
| if (is_call_operator(a) || is_call_operator(b)) | ||
| return is_call_operator(a) && is_call_operator(b); | ||
| bool a_is_operator = is_operator_function(a); |
| // viewed/owned object. | ||
| R operator()(Args... args) noexcept(IsNoexcept) | ||
| protected: | ||
| // Widens the EnclosingType pointer to the enclosing protocol/protocol_view |
| #ifndef XYZ_REFLECTION_OPERATORS_H_ | ||
| #define XYZ_REFLECTION_OPERATORS_H_ | ||
|
|
||
| // The overloadable operators a protocol interface may declare as member |
There was a problem hiding this comment.
Condense this comment block.
| EXPECT_EQ(p[21], 42); | ||
| } | ||
|
|
||
| // Other operator tests for protocol. These exercise the operator table: a |
There was a problem hiding this comment.
This comment block is unneccesary.
| // function's signature (see "name_mangling.h"), so an entry can be found by | ||
| // the signature it implements rather than by declaration order. | ||
| // | ||
| // Neither implementation currently supports operators other than operator(). |
| // or `operatorX` for an operator function, which has no identifier. | ||
| consteval std::string function_display_name(std::meta::info function) { | ||
| if (has_identifier(function)) return std::string(identifier_of(function)); | ||
| return "operator" + std::string(symbol_of(operator_of(function))); |
There was a problem hiding this comment.
Q: Why do we need operatorX?
| // Which operator a thunk exposes for its call syntax. A named interface member | ||
| // is reached through its enclosing `member_base`'s named data member and so is | ||
| // dispatched through `operator()`; an operator interface member is reached | ||
| // directly and uses the operator it declares. |
There was a problem hiding this comment.
Q: What does 'directly' mean here?
| // Widens the EnclosingType pointer to the enclosing protocol/protocol_view | ||
| // object, then calls through its stored vtable pointer's matching function | ||
| // pointer, passing the viewed/owned object. | ||
| R dispatch(Args... args) noexcept(IsNoexcept) |
There was a problem hiding this comment.
I think we still need operator() on the thunks? Renaming this is misleading.
No description provided.