Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-10-06 07:53:16


Bronek Kozicki wrote:

> What's wrong with simple:
>
> template <typename T> struct wrapper
> {
> static T data;
> };
>
> template <typename T>
> T wrapper<T>::data;
>
> template<C> void foo(C arg)
> {
> bar<C>& abar = wrapper<bar<C> >::data;
> }
>
> ... which will trigger static (thread-safe) initialization.

This doesn't solve the initialization order problem, the primary reason for
using local statics in the first place.


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