Boost logo

Boost :

Subject: Re: [boost] [any] new version
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2011-09-01 02:10:05


2011/9/1 Agustín K-ballo Bergé <kaballo86_at_[hidden]>

> On 01/09/2011 2:14, Julien Nitard wrote:
>
>> Out of curiosity, would a static member function with a static variable
>> solve that kind of issue ? (Let's forget potential threading issues
>> mentioned in the Singularity discussion).
>>
>
> It can't, you will end up with a different function static variable for
> each translation unit.

This isn't the case. If you have an inline function with a static variable
in it, it'll be the same variable in all translation units.

*7.1.2p4 A static local variable in an extern inline function always refers
to the same object.*

Roman Perepelitsa.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk