Skip to content
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

[basic.stc.dynamic.general], [func.wrap.func], [any.class.general] "Dynamically allocated" is not defined #7261

Open
Eisenwave opened this issue Sep 19, 2024 · 3 comments · May be fixed by #7328

Comments

@Eisenwave
Copy link
Contributor

Eisenwave commented Sep 19, 2024

In a number of normative paragraphs, we use the term "dynamically allocated", but it is never defined:

We could generally fix this problem by talking about

objects with dynamic storage duration

... instead of

dynamically allocated objects

... or by talking about allocation functions.

Implementations should avoid the use of
-dynamically allocated memory
+storage obtained through allocation functions
for a small contained value.

Also, I'm not too hyped about the recommended practice being copied and pasted into three separate std::function constructors, but it's not the end of the world.

Note: I've noticed this issue when working on #7260.

@frederick-vs-ja
Copy link
Contributor

Perhaps it's more consistent to say the way round (LWG4141) - implementations should make the small contained object nested within the constructed object.

@frederick-vs-ja
Copy link
Contributor

I think there should be a follow-up LWG issue to ensure that when the target object is a function pointer or a reference_wrapper, it's always nested within the type-erased wrapper object. The current wording is too loose to ensure this.

@Eisenwave

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants