Date: Mon, 10 Aug 2026 12:33:05 +0200
On 2026-08-10 at 11:41, Bingzhi via Std-Proposals wrote:
> template <class T> constexpr bool integer_like_v = integral<T>;
> template <> constexpr bool integer_like_v<bool> = false;
> template <> constexpr bool integer_like_v<max_size_type> = true;
> final template <> constexpr bool integer_like_v<max_diff_type> = true;
>
> template <> constexpr bool integer_like_v<__max_size_type> = true; //
> must be error
>
> Even more, final can be used to end template overloads and regular
> overloads.
>
> namespace ranges {
> template <class T, class U> constexpr void swap(T&& t, U&& u);
> template <class T, size_t N> constexpr void swap(T (&t)[N], T (&u)[N]);
> // ...
> final template <class T> constexpr void swap(T& t, T& u);
>
> template <class T> constexpr void swap(T&& t, T&& u); // must be error
> constexpr void swap(integral auto& t, integral auto& u); // must be error
>
> constexpr void swap(int& t, int& u);
> final constexpr void swap(short& t, short& u);
> constexpr void swap(long& t, long& u); // must be error
> }
>
> final constexpr uint64_t gcd(uint64_t, uint64_t) noexcept;
> //constexpr uint32_t gcd(uint32_t, uint32_t) noexcept; // must be error
>
>
This would all be very sensitive to include order, if overloads are
forbidden only after the 'final'.
> template <class T> constexpr bool integer_like_v = integral<T>;
> template <> constexpr bool integer_like_v<bool> = false;
> template <> constexpr bool integer_like_v<max_size_type> = true;
> final template <> constexpr bool integer_like_v<max_diff_type> = true;
>
> template <> constexpr bool integer_like_v<__max_size_type> = true; //
> must be error
>
> Even more, final can be used to end template overloads and regular
> overloads.
>
> namespace ranges {
> template <class T, class U> constexpr void swap(T&& t, U&& u);
> template <class T, size_t N> constexpr void swap(T (&t)[N], T (&u)[N]);
> // ...
> final template <class T> constexpr void swap(T& t, T& u);
>
> template <class T> constexpr void swap(T&& t, T&& u); // must be error
> constexpr void swap(integral auto& t, integral auto& u); // must be error
>
> constexpr void swap(int& t, int& u);
> final constexpr void swap(short& t, short& u);
> constexpr void swap(long& t, long& u); // must be error
> }
>
> final constexpr uint64_t gcd(uint64_t, uint64_t) noexcept;
> //constexpr uint32_t gcd(uint32_t, uint32_t) noexcept; // must be error
>
>
This would all be very sensitive to include order, if overloads are
forbidden only after the 'final'.
Received on 2026-08-10 10:33:11
