Date: Fri, 13 Mar 2026 23:47:28 +0800
On Fri, 13 Mar 2026 at 04:45, Deslauriers, Douglas via Std-Discussion <
std-discussion_at_[hidden]> wrote:
> Hello,
>
> I was reading the section for _forwarding references_
> https://timsong-cpp.github.io/cppwp/temp.deduct.call#3
>
> > A forwarding reference is an rvalue reference to a cv-unqualified
> > template parameter that does not represent a template parameter of a
> > class template (during class template argument *deduction*
> > ([over.match.class.deduct])).
>
> And was wondering if that made the parameter "t" a forwarding reference
> in the following example, despite the fact that its template parameter
> is that of a variable template.
>
> template<typename T>
> auto var = [](T&& t) { std::forward(t); };
>
> Did the standard intend for this to be the case?
The whole section is about template argument deduction. Your code does not
allow any deduction of T.
Only function templates (since C++98) and class templates (since C++17)
allow deduction of template arguments.
std-discussion_at_[hidden]> wrote:
> Hello,
>
> I was reading the section for _forwarding references_
> https://timsong-cpp.github.io/cppwp/temp.deduct.call#3
>
> > A forwarding reference is an rvalue reference to a cv-unqualified
> > template parameter that does not represent a template parameter of a
> > class template (during class template argument *deduction*
> > ([over.match.class.deduct])).
>
> And was wondering if that made the parameter "t" a forwarding reference
> in the following example, despite the fact that its template parameter
> is that of a variable template.
>
> template<typename T>
> auto var = [](T&& t) { std::forward(t); };
>
> Did the standard intend for this to be the case?
The whole section is about template argument deduction. Your code does not
allow any deduction of T.
Only function templates (since C++98) and class templates (since C++17)
allow deduction of template arguments.
-- Yongwei Wu URL: http://wyw.dcweb.cn/
Received on 2026-03-13 15:47:42
