Date: Thu, 02 Oct 2025 16:13:58 -0700
On Thursday, 2 October 2025 13:57:31 Pacific Daylight Time Walt Karas via Std-
Proposals wrote:
> This would have been nice to have for a class I'm currently working on. The
> only work-around I could to come up with was to make it a class template
> where the instantiations are singletons. The template takes a single
> (class) parameter. The only purpose of the template parameter is to create
> distinct instantiations, with distinct thread_local member variables.
You can already do this by having a static thread_local member or non-member
that is your data. It's a bit more typing, but I don't see this as a frequent
enough need to require direct language support.
Proposals wrote:
> This would have been nice to have for a class I'm currently working on. The
> only work-around I could to come up with was to make it a class template
> where the instantiations are singletons. The template takes a single
> (class) parameter. The only purpose of the template parameter is to create
> distinct instantiations, with distinct thread_local member variables.
You can already do this by having a static thread_local member or non-member
that is your data. It's a bit more typing, but I don't see this as a frequent
enough need to require direct language support.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center Group
Received on 2025-10-02 23:14:21