1 // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
2 // Copyright (C) 2014, 2015 Andrzej Krzemienski.
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org/libs/optional for documentation.
10 // You are welcome to contact the author at:
11 // fernando_cacciola@hotmail.com
13 #ifndef BOOST_NONE_17SEP2003_HPP
14 #define BOOST_NONE_17SEP2003_HPP
16 #include "boost/none_t.hpp"
18 // NOTE: Borland users have to include this header outside any precompiled headers
19 // (bcc<=5.64 cannot include instance data in a precompiled header)
20 // -- * To be verified, now that there's no unnamed namespace
24 #ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
26 none_t const none = (static_cast<none_t>(0)) ;
28 #elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE
30 namespace detail { namespace optional_detail {
32 // the trick here is to make boost::none defined once as a global but in a header file
36 static const T instance;
40 const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required
42 } } // namespace detail::optional_detail
47 const none_t& none = detail::optional_detail::none_instance<none_t>::instance;
52 const none_t none ((none_t::init_tag()));
54 #endif // older definitions
58 #endif // header guard