C++ Logo

std-proposals

Advanced search

Re: Pure value templates

From: Ramkumar Ramachandra <artagnon_at_[hidden]>
Date: Mon, 21 Sep 2020 22:38:48 +0200
Ah, thanks!

R.

On Mon, Sep 21, 2020 at 10:36 PM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Mon, Sep 21, 2020 at 3:29 PM Ramkumar Ramachandra via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > I would like to propose:
> >
> > ```
> > template <typename T = decltype(V), T V>
> > constexpr auto Sz = std::extent_v(V);
> > ```
>
> That's a circular definition. The compiler can't know what `V` is
> without knowing what `T` is and vice-versa.
>
> Equally importantly, I'm pretty sure C++17 gives us similar
> functionality as follows:
>
> ```
> template<auto V>
> constexpr auto Sz = std::extent_v<decltype(V)>;
> ```
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-09-21 15:39:27