Blame boost/none.hpp

Packit 58578d
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
Packit 58578d
// Copyright (C) 2014, 2015 Andrzej Krzemienski.
Packit 58578d
//
Packit 58578d
// Distributed under the Boost Software License, Version 1.0.
Packit 58578d
// (See accompanying file LICENSE_1_0.txt or copy at
Packit 58578d
// http://www.boost.org/LICENSE_1_0.txt)
Packit 58578d
//
Packit 58578d
// See http://www.boost.org/libs/optional for documentation.
Packit 58578d
//
Packit 58578d
// You are welcome to contact the author at:
Packit 58578d
//  fernando_cacciola@hotmail.com
Packit 58578d
//
Packit 58578d
#ifndef BOOST_NONE_17SEP2003_HPP
Packit 58578d
#define BOOST_NONE_17SEP2003_HPP
Packit 58578d
Packit 58578d
#include "boost/none_t.hpp"
Packit 58578d
Packit 58578d
// NOTE: Borland users have to include this header outside any precompiled headers
Packit 58578d
// (bcc<=5.64 cannot include instance data in a precompiled header)
Packit 58578d
//  -- * To be verified, now that there's no unnamed namespace
Packit 58578d
Packit 58578d
namespace boost {
Packit 58578d
Packit 58578d
#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
Packit 58578d
Packit 58578d
none_t const none = (static_cast<none_t>(0)) ;
Packit 58578d
Packit 58578d
#elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE
Packit 58578d
Packit 58578d
namespace detail { namespace optional_detail {
Packit 58578d
Packit 58578d
  // the trick here is to make boost::none defined once as a global but in a header file
Packit 58578d
  template <typename T>
Packit 58578d
  struct none_instance
Packit 58578d
  {
Packit 58578d
    static const T instance;
Packit 58578d
  };
Packit 58578d
  
Packit 58578d
  template <typename T>
Packit 58578d
  const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required
Packit 58578d
Packit 58578d
} } // namespace detail::optional_detail
Packit 58578d
Packit 58578d
Packit 58578d
namespace {
Packit 58578d
  // TU-local
Packit 58578d
  const none_t& none = detail::optional_detail::none_instance<none_t>::instance; 
Packit 58578d
}
Packit 58578d
Packit 58578d
#else
Packit 58578d
Packit 58578d
const none_t none ((none_t::init_tag()));
Packit 58578d
Packit 58578d
#endif // older definitions
Packit 58578d
Packit 58578d
} // namespace boost
Packit 58578d
Packit 58578d
#endif // header guard
Packit 58578d