Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-18 19:05:08


"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;
> }
>
> 2.
>
> void f()
> {
> typedef C<&k> ck_type;
> ck_type ck;
> }
>
> 3.
>
> typedef C<&k> ck_type;
>
> void f()
> {
> ck_type 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.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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