comparison DEPENDENCIES/generic/include/boost/none.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
1 // Copyright (C) 2003, Fernando Luis Cacciola Carballal. 1 // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
2 // Copyright (C) 2014 Andrzej Krzemienski.
2 // 3 //
3 // Distributed under the Boost Software License, Version 1.0. 4 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt) 6 // http://www.boost.org/LICENSE_1_0.txt)
6 // 7 //
18 // (bcc<=5.64 cannot include instance data in a precompiled header) 19 // (bcc<=5.64 cannot include instance data in a precompiled header)
19 // -- * To be verified, now that there's no unnamed namespace 20 // -- * To be verified, now that there's no unnamed namespace
20 21
21 namespace boost { 22 namespace boost {
22 23
24 #ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
23 none_t const none = (static_cast<none_t>(0)) ; 25 none_t const none = (static_cast<none_t>(0)) ;
26 #else
27
28 namespace detail { namespace optional_detail {
29
30 // the trick here is to make boost::none defined once as a global but in a header file
31 template <typename T>
32 struct none_instance
33 {
34 static const T instance;
35 };
36
37 template <typename T>
38 const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required
39
40 } } // namespace detail::optional_detail
41
42
43 namespace {
44 // TU-local
45 const none_t& none = detail::optional_detail::none_instance<none_t>::instance;
46 }
47
48 #endif
24 49
25 } // namespace boost 50 } // namespace boost
26 51
27 #endif 52 #endif
28 53