Boost logo

Boost :

Subject: Re: [boost] [config] RFC PR 82
From: Vinícius dos Santos Oliveira (vini.ipsmaker_at_[hidden])
Date: 2016-08-01 16:13:26

Sorry about necrobumping, but I've ignored this thread previously as the
subject line didn't make it obvious this thread was of my interest.

2015-11-24 17:20 GMT-03:00 Andrey Semashev <andrey.semashev_at_[hidden]>:

> I don't think for is a good idea, given that the
>>> same effect can be achieved in pure C++.
>> You mean creating a class template with a single dummy template argument
>> and a static data member just so that you can define a global variable in
>> a header w/o linker errors?
> Slightly better:
> template< typename T, typename Tag = void >
> struct singleton
> {
> static T instance;
> };
> template< typename T, typename Tag >
> T singleton< T, Tag >::instance;

I was looking for something similar to BOOST_OVERRIDABLE_SYMBOL as I want
my library header only and Boost.System requires the category to be a
single static object and it'll even use address comparison to test if the
categories are the same:

Is it guaranteed the above code will return the same object even if this
code was included in different libraries used by the same program?

Vinícius dos Santos Oliveira

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