]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/optional/include/boost/none.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / optional / include / boost / none.hpp
1 // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
2 // Copyright (C) 2014, 2015 Andrzej Krzemienski.
3 //
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)
7 //
8 // See http://www.boost.org/libs/optional for documentation.
9 //
10 // You are welcome to contact the author at:
11 // fernando_cacciola@hotmail.com
12 //
13 #ifndef BOOST_NONE_17SEP2003_HPP
14 #define BOOST_NONE_17SEP2003_HPP
15
16 #include "boost/none_t.hpp"
17
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
21
22 namespace boost {
23
24 #ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
25
26 none_t const none = (static_cast<none_t>(0)) ;
27
28 #elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE
29
30 namespace detail { namespace optional_detail {
31
32 // the trick here is to make boost::none defined once as a global but in a header file
33 template <typename T>
34 struct none_instance
35 {
36 static const T instance;
37 };
38
39 template <typename T>
40 const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required
41
42 } } // namespace detail::optional_detail
43
44
45 namespace {
46 // TU-local
47 const none_t& none = detail::optional_detail::none_instance<none_t>::instance;
48 }
49
50 #else
51
52 const none_t none ((none_t::init_tag()));
53
54 #endif // older definitions
55
56 } // namespace boost
57
58 #endif // header guard
59