Boost logo

Boost :

Subject: Re: [boost] [optional] How to define boost::none?
From: Sylvester-Bradley, Gareth (Gareth.Sylvester-Bradley_at_[hidden])
Date: 2014-11-19 10:40:57

Hi Andrey,

On Wed, Nov 19, 2014 at 3:27 PM, Andrey Semashev wrote:
> Since none has internal linkage, it is translation unit-specific.
> Technically, this can cause ODR violations in some cases. To avoid
> that you can declare it like this:
> struct none_t {};
> template< typename T >
> struct singleton
> {
> static const T instance;
> };
> template< typename T >
> const T singleton< T >::instance = T();

  // Do we need...

> const none_t& none = singleton< none_t >::instance;

  // ?


************************************************************************ The information contained in this message or any of its attachments may be confidential and is intended for the exclusive use of the addressee(s). Any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited without the express permission of the sender. The views expressed in this email are those of the individual and not necessarily those of Sony or Sony affiliated companies. Sony email is for business use only. This email and any response may be monitored by Sony to be in compliance with Sony's global policies and standards

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