C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Defect report: not possible to declare-but-not-define a full specialization of a variable template

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 13 Jan 2025 13:39:44 -0800
On Monday 13 January 2025 12:41:02 Pacific Standard Time Avi Kivity via Std-
Proposals wrote:
> Unfortunately, that doesn't work.
>
>
> template <typename T>
> struct A {
> static int x;
> };

You need to declare that this template will be specialised later.

extern template struct A<int>;

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-01-13 21:39:49