-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question regarding the design of the extension functions (subspan etc.) #65
Comments
…inmoene#65) Makes non-standard functiones available in the nonstd namespace and moves their definitions to be located after make_span function definitions.
…inmoene#65) Makes non-standard functiones available in the nonstd namespace and moves their definitions to be located after make_span function definitions.
…inmoene#65) Makes non-standard functions available in the nonstd namespace and moves their definitions to be located after make_span function definitions.
…inmoene#65) Makes non-standard functions available in the nonstd namespace and moves their definitions to be located after make_span definitions.
Hi @vvish Thanks for bringing this up. I've trouble to trace back where the idea for non-member Think the implementation is chosen to reduce the number of overloads needed by letting The changes in your fork seem good to me (after a quick-ish look). Whether it would be better & enough to have |
Thank you @martinmoene for the quick reply. The documentation https://github.com/martinmoene/span-lite/blob/master/README.md#first-last-and-subspan suggests that they were introduced "to avoid having to use the dot template syntax when the span is a dependent type". It looks like if it is the only intended usage then they could receive already constructed If they also act as 'factory' functions constructing sub-spans from span-compatible types (instead of chaining, like I think in both cases, this functions should be available in |
Hi @vvish I think merging the changes you prepared seems a good start. Then look if |
…inmoene#65) Makes non-standard functions available in the nonstd namespace and moves their definitions to be located after make_span definitions.
Makes non-standard functions available in the nonstd namespace and moves their definitions to be located after make_span definitions.
Hi @martinmoene , And thank you very much for your lib-s. They are of great aid. |
Thank you, nice to hear :) You're welcome. Perhaps continue with a new issue like 'Change free functions first(), last(), subspan() to take a span?' to investigate this aspect? |
Hello,
I have a question regarding the design of the free functions:
subspan
,first
andlast
:As they do not explicitly accept
span<T>
are they intended to be used with any type that can be accepted bymake_span
function? If it is the case then the implementation seems to have an issue: as ADL is not finding them with non-span-specialization parameters the call to this functions should be qualified (currently they are not available in thenonstd
namespace) andmake_span
in the trailing return type expression should be visible for non-ADL. Unfortunately the unit-tests cover only the cases where the span specialization is passed to the functions (works because of ADL), so it is not clear if the use-case was considered, although I personally find it to be useful (would be glad to contribute here).If the functions are designed to be used with span-s only as wrappers for methods to avoid
.template
then maybe they could acceptspan<T>
?Could you please clarify the use cases and rational behind the design?
Thank you.
The text was updated successfully, but these errors were encountered: