2 Copyright 2018 Glen Joseph Fernandes
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_CORE_EMPTY_VALUE_HPP
9 #define BOOST_CORE_EMPTY_VALUE_HPP
11 #include <boost/config.hpp>
12 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
16 #if defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40700)
17 #define BOOST_DETAIL_EMPTY_VALUE_BASE
18 #elif defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1800)
19 #define BOOST_DETAIL_EMPTY_VALUE_BASE
20 #elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1800)
21 #define BOOST_DETAIL_EMPTY_VALUE_BASE
22 #elif defined(BOOST_CLANG) && !defined(__CUDACC__)
23 #if __has_feature(is_empty) && __has_feature(is_final)
24 #define BOOST_DETAIL_EMPTY_VALUE_BASE
30 #pragma warning(disable:4510)
36 struct use_empty_value_base {
38 #if defined(BOOST_DETAIL_EMPTY_VALUE_BASE)
39 value = __is_empty(T) && !__is_final(T)
46 struct empty_init_t { };
50 template<class T, unsigned N = 0,
51 bool E = boost::use_empty_value_base<T>::value>
56 #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
57 empty_value() = default;
62 empty_value(boost::empty_init_t)
65 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
66 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
67 template<class U, class... Args>
68 empty_value(boost::empty_init_t, U&& value, Args&&... args)
69 : value_(std::forward<U>(value), std::forward<Args>(args)...) { }
72 empty_value(boost::empty_init_t, U&& value)
73 : value_(std::forward<U>(value)) { }
77 empty_value(boost::empty_init_t, const U& value)
81 empty_value(boost::empty_init_t, U& value)
85 const T& get() const BOOST_NOEXCEPT {
89 T& get() BOOST_NOEXCEPT {
97 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
98 template<class T, unsigned N>
99 class empty_value<T, N, true>
104 #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
105 empty_value() = default;
110 empty_value(boost::empty_init_t)
113 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
114 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
115 template<class U, class... Args>
116 empty_value(boost::empty_init_t, U&& value, Args&&... args)
117 : T(std::forward<U>(value), std::forward<Args>(args)...) { }
120 empty_value(boost::empty_init_t, U&& value)
121 : T(std::forward<U>(value)) { }
125 empty_value(boost::empty_init_t, const U& value)
129 empty_value(boost::empty_init_t, U& value)
133 const T& get() const BOOST_NOEXCEPT {
137 T& get() BOOST_NOEXCEPT {
145 using empty_::empty_value;
147 BOOST_INLINE_CONSTEXPR empty_init_t empty_init = empty_init_t();
151 #if defined(_MSC_VER)