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