
26 Jan
2010
26 Jan
'10
7:38 p.m.
Andrew Chinkoff <achinkoff@gmail.com> wrote:
1) Boost::global example:
typedef boost::global<int> global_Int; global_int.get() = 5; // getting the global int
2) Boost::Singleton example:
typedef boost::Singleton<int> global_Int; global_Int::Instance() = 5;
I really do not understand the appreciable advantage of the 1) over the 2) and vice versa.:confused: The only thing I could say is that "get" is shorter word than "Instance", isn't it?
Do you not see your implementation of singleton cannot, with its intrusive nature, make a global int? Fair enough it's highly unlikely you'll ever need a global POD, but like I said to Robert, a global utility *could* do it, and it could also be a singleton if desired.