Open
Conversation
… yet into an object of the delegate type).
TODO: the actual implementation. - Added project to CMakeLists.txt - Added skeleton for example - Added (unrelated) experiment for &auto::foo emulation.
In order to add helpers to the invokers to make them point to both the free- and member-function invoker, we need to hardcode the names of the classes. This makes it also a bit easier to follow with respect to debuggability.
- Removed repeatedly defined INVOKER. - Removed MEMBER_FUNCTION-prefix from infix invoker: it is not a member function. - Renamed the corresponding class for the above invoker to 'reflector_free_function'. This way, both the member-function exposer as well as the free-function exposer can use the same invoker.
They are already private inside of a class.
Later, this will be given helper function 'as_nonmember()' and 'as_member()', for supporting unified call syntax.
… syntax.
the problem is as follows:
using namespace algorithms;
$(v).sorted();
\-> on_call() -> call() -> sorted(v)
}
the last sorted() function doesn't know which namespaces it should consider, because what has been inserted in the caller's scope (i.e. using namespace algorithms;) is lost there.
The idea is to register all the namespaces that need to be considered, by inserting a tag type into each of them. Then an additional smart reference is wrapped around the underlying object before calling the actual free-function (i.e. sorted(v)). This smart reference contains as a template argument the inserted tag type. As a result, adl will also consider the tag type's namespace, which is the namespace that contains the correct function. Because the smart reference type implicitly converts to the underlying type, everything works automagically.
This will be needed to make the unified call syntax work.
…llows for including the lookup to include additional namespaces.
…ltiple namespaces.
…de for each smart reference individually.
…ection library itself.
- Unused variables. - Mixing of struct/class for same definition.
Also put them into two separate namespaces, to test multi-namespace support.
- User-defined conversion functions should be defined for all value categories - Added missing namespace qualifier - Added several using directives to find the algorithms
Later, this macro will probably be renamed to REFLECTABLE_OPERATOR, because it is generally the default one that should be used.
This, because for REFLECTABLE_OPERATOR() there cannot be a reflector_free_function_invoker.
This is needed in case the member function or free function that is being called captures the parameter as a templatized type, in which case the underlying object will not be pulled out of the adl_finder. In that case, it is very likely that the called function uses the interface of the passed parameter (which is now a smart reference). Therefore, it needs to forward the entire interface, and not only the conversion to the underlying type. Hence, a full-fledged smart reference type is required.
Wrapping non-const lvalue-references is problematic at the moment, and requires a rather major refactoring. Therefore, disable support for those value categories for now, such that we can move forward.
This makes remembering the syntax a bit easier :')
…l of reference-leaking)
Because of the adl_finder (i.e. the mechanism that enables lookup in registered namespaces), the call() function (the one called by the invoker) will also consider the originally called function, which in turn calls the on_call function, resulting in the infinite recursion. - Added a mechanism that detects this recursion, and disables the on_call function overload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.