On Jan 16, 2022, at 8:36 AM, Andrey Davydov <andrey.davydov@jetbrains.com> wrote:

I wonder what is the lifetime of underlying storage referenced by std::span returned from such functions as std::meta::members_of? Is this array persisted throughout the compilation process?

That’s a good question (and one of the reasons I was reluctant to make the vector->span change at first).

An implementation is of course free to recompute the array if it needs to. However, if the array “leaks” outside constant-evaluation, it is likely to be made persistent, but doesn’t leak.

I don’t expect span<info> objects to typically “leak”, but the “string_view” objects yes. 


Another question is why s_members.size() == 7 in the example on page 35? Why members_of(^S) include generated constructors and the destructor, but don't include generated assignment operators?

Oops — that’s a bug.  It should be 9.


If i understand correctly std::meta::parameters_of could return function parameters or template parameters depending on the argument, and so for the following function template:

template<typename X, typename Y>
void f(X a, Y b);

parameters_of(^f) == {^X, ^Y};
parameters_of(^f(1, 2)) == {^a, ^b};

Correct.


And likewise for generic lambda
auto lambda = []<typename X, typename Y>(X a, Y b) {};

parameters_of(^decltype(lambda)) == {^X, ^Y};
parameters_of(^lambda(1, 2)) = {^a, ^b};

Maybe it makes sense to split function `parameters_of` to 2 separate functions `function_parameters_of` and `template_paramters_of`?

Yes, that would make sense.  I’ll check what others think, but it could probably help avoid confusion.

Daveed


On Sat, Jan 15, 2022 at 8:41 PM Daveed Vandevoorde via SG7 <sg7@lists.isocpp.org> wrote:
Hello reflecting friends,

(And Happy New Year!)

I’ve uploaded on the 2022 Teleconferences wiki for SG-7 an updated version of P1240 (which has also been submitted for the next mailing).

Changes include:
        — The syntax agreements that SG-7 voted through P2320 (e.g., prefix ^ instead of reflexpr(…) to create reflections)
        — The proposed metafunctions now use span and string_view instead of vector and string
        — Various corrections and clarifications based on reader feedback and implementation experience

        Daveed

--
SG7 mailing list
SG7@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg7

--
Andrey Davydov