Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-02-19 08:30:51


David Abrahams wrote:
> "Peter Dimov" <pdimov_at_[hidden]> writes:
>
>> Looks like a no-brainer, &k can't be a compile-time constant if k is
>> thread-local.
>>
>> 1.
>>
>> void f()
>> {
>> C<&k> ck;
>> }
[...]
>> The type of ck cannot depend on the thread that is executing f.
>
> It doesn't have to. When used as a template parameter, an address
> could refer to something more like a member function pointer, i.e. an
> offset in the thread's table of globals.

C has been declared as

template<int * p> class C;

An int* is an int*. I don't think that any implementation has
mini-union-pointers to accomodate thread local addresses. The performance
impact would kill pointers.


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