| 
									
										
										
										
											2004-07-07 15:04:52 +00:00
										 |  |  | // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
 | 
					
						
							| 
									
										
										
										
											2015-10-14 23:11:33 +02:00
										 |  |  | // Copyright (C) 2014, 2015 Andrzej Krzemienski.
 | 
					
						
							| 
									
										
										
										
											2004-07-07 15:04:52 +00:00
										 |  |  | //
 | 
					
						
							| 
									
										
										
										
											2006-07-20 23:23:09 +00:00
										 |  |  | // Distributed under the Boost Software License, Version 1.0.
 | 
					
						
							|  |  |  | // (See accompanying file LICENSE_1_0.txt or copy at
 | 
					
						
							| 
									
										
										
										
											2004-07-07 15:04:52 +00:00
										 |  |  | // http://www.boost.org/LICENSE_1_0.txt)
 | 
					
						
							|  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2007-11-25 18:07:19 +00:00
										 |  |  | // See http://www.boost.org/libs/optional for documentation.
 | 
					
						
							| 
									
										
										
										
											2004-07-07 15:04:52 +00:00
										 |  |  | //
 | 
					
						
							|  |  |  | // You are welcome to contact the author at:
 | 
					
						
							| 
									
										
										
										
											2007-11-25 18:07:19 +00:00
										 |  |  | //  fernando_cacciola@hotmail.com
 | 
					
						
							| 
									
										
										
										
											2004-07-07 15:04:52 +00:00
										 |  |  | //
 | 
					
						
							|  |  |  | #ifndef BOOST_NONE_17SEP2003_HPP
 | 
					
						
							|  |  |  | #define BOOST_NONE_17SEP2003_HPP
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-29 21:21:03 +03:00
										 |  |  | #include "boost/config.hpp"
 | 
					
						
							| 
									
										
										
										
											2007-11-25 18:07:19 +00:00
										 |  |  | #include "boost/none_t.hpp"
 | 
					
						
							| 
									
										
										
										
											2007-04-12 14:25:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-25 18:07:19 +00:00
										 |  |  | // NOTE: Borland users have to include this header outside any precompiled headers
 | 
					
						
							|  |  |  | // (bcc<=5.64 cannot include instance data in a precompiled header)
 | 
					
						
							|  |  |  | //  -- * To be verified, now that there's no unnamed namespace
 | 
					
						
							| 
									
										
										
										
											2007-04-12 14:25:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-25 18:07:19 +00:00
										 |  |  | namespace boost { | 
					
						
							| 
									
										
										
										
											2007-04-12 14:25:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-22 01:18:25 +01:00
										 |  |  | #ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
 | 
					
						
							| 
									
										
										
										
											2015-10-01 15:26:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-24 17:17:10 +02:00
										 |  |  | BOOST_INLINE_VARIABLE none_t BOOST_CONSTEXPR_OR_CONST none = (static_cast<none_t>(0)) ; | 
					
						
							| 
									
										
										
										
											2015-10-01 15:26:15 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE
 | 
					
						
							| 
									
										
										
										
											2014-11-22 01:18:25 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace detail { namespace optional_detail { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // the trick here is to make boost::none defined once as a global but in a header file
 | 
					
						
							|  |  |  |   template <typename T> | 
					
						
							|  |  |  |   struct none_instance | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     static const T instance; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2019-10-29 21:21:03 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-22 01:18:25 +01:00
										 |  |  |   template <typename T> | 
					
						
							|  |  |  |   const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } } // namespace detail::optional_detail
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace { | 
					
						
							|  |  |  |   // TU-local
 | 
					
						
							| 
									
										
										
										
											2020-10-24 17:17:10 +02:00
										 |  |  |   const none_t& none = detail::optional_detail::none_instance<none_t>::instance; | 
					
						
							| 
									
										
										
										
											2014-11-22 01:18:25 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-01 15:26:15 +02:00
										 |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-24 17:17:10 +02:00
										 |  |  | BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST none_t none ((none_t::init_tag())); | 
					
						
							| 
									
										
										
										
											2015-10-01 15:26:15 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif // older definitions
 | 
					
						
							| 
									
										
										
										
											2007-04-12 14:25:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-25 18:07:19 +00:00
										 |  |  | } // namespace boost
 | 
					
						
							| 
									
										
										
										
											2007-04-12 14:25:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-01 15:26:15 +02:00
										 |  |  | #endif // header guard
 |