Skip to content

Conversation

@brendandahl
Copy link
Collaborator

This is a little cleaner than having to define a recursive template for each of these is<SomePolicy>. std::disjunction isn't available until c++17, so I also added a polyfill.

I also changed conjunction to use std::conjunction when it is available and polyfill otherwise.

This is a little cleaner than having to define a recursive template
for each of these `is<SomePolicy>`. std::disjunction isn't available until
c++17, so I also added a polyfill.

I also changed conjunction to use std::conjunction when it is available and
polyfill otherwise.
struct isNonnullReturn<> {
static constexpr bool value = false;
};
using isNonnullReturn = disjunction<std::is_same<nonnull<ret_val>, Policies>...>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

What are async and non_null in the above lines by the way? Are they special values defines somewhere, or just some kind of placeholder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Policy args are basically options you can pass into function bindings. e.g.

   function('sleep', &sleep, async());
   function('constructor', &constructor, nonnull<ret_val>());

@brendandahl brendandahl merged commit df22009 into emscripten-core:main Sep 20, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants