C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Allow using type alias in requires-clause

From: Hewill Kang <hewillk_at_[hidden]>
Date: Sat, 20 Jun 2026 17:32:04 +0800
Hi all,

After three years, I finally had the opportunity to finish this paper, and
I am grateful for any feedback:

https://isocpp.org/files/papers/D4281R0.html

Kang Hewill <hewillk_at_[hidden]> 於 2023年8月16日週三 下午11:39寫道:

> Hello all C++ experts,
>
> I find it very convenient to allow using-type alias in the requires
> -clause.
>
> For complex type aliases, simplifying them with using-alias can reduce
> redundant spelling for subsequent constraint checks on the same type alias.
>
> Take the standard concept *indirectly-readable-impl*
> <https://eel.is/c++draft/iterator.concept.readable> as an example:
>
> template<class In>
> concept indirectly-readable-impl =
> requires(const In in) {
> typename iter_value_t<In>;
> typename iter_reference_t<In>;
> typename iter_rvalue_reference_t<In>;
> { *in } -> same_as<iter_reference_t<In>>;
> { ranges::iter_move(in) } -> same_as<iter_rvalue_reference_t<In>>;
> } &&
> common_reference_with<iter_reference_t<In>&&, iter_value_t<In>&> &&
> common_reference_with<iter_reference_t<In>&&, iter_rvalue_reference_t<In>&&> &&
> common_reference_with<iter_rvalue_reference_t<In>&&, const iter_value_t<In>&>;
>
> we can simplify it to:
>
> template<class In>
> concept indirectly-readable-impl =
> requires(const In in) {
> using value_type = typename iter_value_t<In>;
> using reference = typename iter_reference_t<In>;
> using rvalue_reference = typename iter_rvalue_reference_t<In>;
> { *in } -> same_as<reference>;
> { ranges::iter_move(in) } -> same_as<rvalue_reference>;
> requires common_reference_with<reference&&, value_type&>;
> requires common_reference_with<reference&&, rvalue_reference&>;
> requires common_reference_with<rvalue_reference&&, const value_type&>;
> };
>
> Do you think it's worth supporting this using-alias syntax in the requires
> -clause?
>
> Hewill
>

Received on 2026-06-20 09:32:17