Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[SUGGESTION] Requires clause for aliases #407

Closed
JohelEGP opened this issue May 2, 2023 · 1 comment
Closed

[SUGGESTION] Requires clause for aliases #407

JohelEGP opened this issue May 2, 2023 · 1 comment

Comments

@JohelEGP
Copy link
Contributor

JohelEGP commented May 2, 2023

A natural extension to 63efa6e.

Will your feature suggestion eliminate X% of security vulnerabilities of a given kind in current C++ code? No.

Will your feature suggestion automate or eliminate X% of current C++ guidance literature?

(Make it possible to) make the default:

No longer teach:

Describe alternatives you've considered.
https://cpp2.godbolt.org/z/Mr9TMo7xG:

i: <T> type
  // requires std::integral<T>
  == std::enable_if<
        std::integral<T>,
        std::make_signed<T>
      >::type::type;
@JohelEGP
Copy link
Contributor Author

JohelEGP commented Jun 9, 2023

This is better dealt with after #486.

A test: https://cpp2.godbolt.org/z/bxsvexdxr.

integer_t: <T> type requires std::integral<T>           == T;
integer_v: <V: _> _ requires std::integral<decltype(V)> == V;
main: () = {
  std::ignore = integer_t<u32>(integer_v<:u32                        = 0>);
  static_assert(!std::invocable<decltype(:<T> (x: T) -> integer_t<T> = {}), std::nullptr_t>);
  static_assert(!std::invocable<decltype(:<T> (x: T) -> std::type_identity_t<decltype(integer_v<:T = nullptr>)> = {}),
                                         std::nullptr_t>);
}

Repository owner locked and limited conversation to collaborators Aug 30, 2023
@hsutter hsutter converted this issue into discussion #640 Aug 30, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

1 participant