Skip to content

[SUGGESTION] Requires clause for aliases #407

Description

@JohelEGP

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;

Activity

  1. JohelEGP commented on Jun 9, 2023

    @JohelEGP
    ContributorAuthor

    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>);
    }
    
  2. Repository owner locked and limited conversation to collaborators on Aug 30, 2023
  3. converted this issue into a discussion #640 on Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions