Boost logo

Boost :

Subject: Re: [boost] [Boost.utility]
From: GMan (gmannickg_at_[hidden])
Date: 2010-01-26 14:38:04

Andrew Chinkoff <achinkoff_at_[hidden]> 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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at