Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-27 12:36:49


Hi John,

On Tue, 27 Mar 2001, John Maddock wrote:
John_M> I posted about this before, but got no responce, so lets try again (there
John_M> was a posting blizzard going on at the time!).

Sorry John! Yes this one got burried.

John_M> Since this code is never run, how about:
John_M>
John_M> // This is a helper class that provides a way to get a reference to
John_M> // an object.
John_M> template <class T>
John_M> class static_object {
John_M> public:
John_M> static T& get() {
John_M> char d[sizeof(T)];
John_M> return *reinterpret_cast<T*>(d);
John_M> }
John_M> };

Yes, your solution is much better!! If you want to check in the change, go
ahead, otherwise I will.

Cheers,
Jerem

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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