<div dir="ltr">I have a small personal project where I used to use this. I tried switching to <optional> instead, but that apparently requires -std=c++17. With that, things build fine with my locally-built clang, but latest Xcode clang doesn't accept that flag yet. So I tried -std=c++1z, but latest Xcode (9.2) doesn't event include the <optional> header yet. So now I have no way of being able to build my project with both trunk clang and Xcode clang. Maybe a one-year deprecation period is too short?<div><br></div><div>(It's not a huge deal, I have a optional<> implementation in my project for platforms that don't ship it yet, but things used to be fine on mac until this change at least. It's also not an important project, I just thought I'd point out that this makes life more complicated than it would be if the deletion period was longer.)</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 1, 2018 at 9:54 AM, Marshall Clow via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: marshall<br>
Date: Thu Feb 1 06:54:25 2018<br>
New Revision: 323971<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=323971&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=323971&view=rev</a><br>
Log:<br>
Remove <experimental/optional>; use <optional> instead. See <a href="https://libcxx.llvm.org/TS_deprecation.html" rel="noreferrer" target="_blank">https://libcxx.llvm.org/TS_<wbr>deprecation.html</a><br>
<br>
Removed:<br>
libcxx/trunk/test/libcxx/<wbr>experimental/optional/<br>
libcxx/trunk/test/std/<wbr>experimental/optional/<br>
Modified:<br>
libcxx/trunk/include/<wbr>experimental/optional<br>
libcxx/trunk/include/module.<wbr>modulemap<br>
libcxx/trunk/src/optional.cpp<br>
libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp<br>
libcxx/trunk/test/libcxx/min_<wbr>max_macros.sh.cpp<br>
<br>
Modified: libcxx/trunk/include/<wbr>experimental/optional<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/optional?rev=323971&r1=323970&r2=323971&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/include/<wbr>experimental/optional?rev=<wbr>323971&r1=323970&r2=323971&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/<wbr>experimental/optional (original)<br>
+++ libcxx/trunk/include/<wbr>experimental/optional Thu Feb 1 06:54:25 2018<br>
@@ -8,915 +8,4 @@<br>
//<br>
//===-------------------------<wbr>------------------------------<wbr>---------------===//<br>
<br>
-#ifndef _LIBCPP_EXPERIMENTAL_OPTIONAL<br>
-#define _LIBCPP_EXPERIMENTAL_OPTIONAL<br>
-<br>
-/*<br>
- optional synopsis<br>
-<br>
-// C++1y<br>
-<br>
-namespace std { namespace experimental { inline namespace fundamentals_v1 {<br>
-<br>
- // 5.3, optional for object types<br>
- template <class T> class optional;<br>
-<br>
- // 5.4, In-place construction<br>
- struct in_place_t{};<br>
- constexpr in_place_t in_place{};<br>
-<br>
- // 5.5, No-value state indicator<br>
- struct nullopt_t{see below};<br>
- constexpr nullopt_t nullopt(unspecified);<br>
-<br>
- // 5.6, Class bad_optional_access<br>
- class bad_optional_access;<br>
-<br>
- // 5.7, Relational operators<br>
- template <class T><br>
- constexpr bool operator==(const optional<T>&, const optional<T>&);<br>
- template <class T><br>
- constexpr bool operator!=(const optional<T>&, const optional<T>&);<br>
- template <class T><br>
- constexpr bool operator<(const optional<T>&, const optional<T>&);<br>
- template <class T><br>
- constexpr bool operator>(const optional<T>&, const optional<T>&);<br>
- template <class T><br>
- constexpr bool operator<=(const optional<T>&, const optional<T>&);<br>
- template <class T><br>
- constexpr bool operator>=(const optional<T>&, const optional<T>&);<br>
-<br>
- // 5.8, Comparison with nullopt<br>
- template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;<br>
- template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;<br>
- template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;<br>
- template <class T> constexpr bool operator!=(nullopt_t, const optional<T>&) noexcept;<br>
- template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;<br>
- template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;<br>
- template <class T> constexpr bool operator<=(const optional<T>&, nullopt_t) noexcept;<br>
- template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept;<br>
- template <class T> constexpr bool operator>(const optional<T>&, nullopt_t) noexcept;<br>
- template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept;<br>
- template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;<br>
- template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;<br>
-<br>
- // 5.9, Comparison with T<br>
- template <class T> constexpr bool operator==(const optional<T>&, const T&);<br>
- template <class T> constexpr bool operator==(const T&, const optional<T>&);<br>
- template <class T> constexpr bool operator!=(const optional<T>&, const T&);<br>
- template <class T> constexpr bool operator!=(const T&, const optional<T>&);<br>
- template <class T> constexpr bool operator<(const optional<T>&, const T&);<br>
- template <class T> constexpr bool operator<(const T&, const optional<T>&);<br>
- template <class T> constexpr bool operator<=(const optional<T>&, const T&);<br>
- template <class T> constexpr bool operator<=(const T&, const optional<T>&);<br>
- template <class T> constexpr bool operator>(const optional<T>&, const T&);<br>
- template <class T> constexpr bool operator>(const T&, const optional<T>&);<br>
- template <class T> constexpr bool operator>=(const optional<T>&, const T&);<br>
- template <class T> constexpr bool operator>=(const T&, const optional<T>&);<br>
-<br>
- // 5.10, Specialized algorithms<br>
- template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);<br>
- template <class T> constexpr optional<see below> make_optional(T&&);<br>
-<br>
- template <class T><br>
- class optional<br>
- {<br>
- public:<br>
- typedef T value_type;<br>
-<br>
- // 5.3.1, Constructors<br>
- constexpr optional() noexcept;<br>
- constexpr optional(nullopt_t) noexcept;<br>
- optional(const optional&);<br>
- optional(optional&&) noexcept(see below);<br>
- constexpr optional(const T&);<br>
- constexpr optional(T&&);<br>
- template <class... Args> constexpr explicit optional(in_place_t, Args&&...);<br>
- template <class U, class... Args><br>
- constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);<br>
-<br>
- // 5.3.2, Destructor<br>
- ~optional();<br>
-<br>
- // 5.3.3, Assignment<br>
- optional& operator=(nullopt_t) noexcept;<br>
- optional& operator=(const optional&);<br>
- optional& operator=(optional&&) noexcept(see below);<br>
- template <class U> optional& operator=(U&&);<br>
- template <class... Args> void emplace(Args&&...);<br>
- template <class U, class... Args><br>
- void emplace(initializer_list<U>, Args&&...);<br>
-<br>
- // 5.3.4, Swap<br>
- void swap(optional&) noexcept(see below);<br>
-<br>
- // 5.3.5, Observers<br>
- constexpr T const* operator ->() const;<br>
- constexpr T* operator ->();<br>
- constexpr T const& operator *() const &;<br>
- constexpr T& operator *() &;<br>
- constexpr T&& operator *() &&;<br>
- constexpr const T&& operator *() const &&;<br>
- constexpr explicit operator bool() const noexcept;<br>
- constexpr T const& value() const &;<br>
- constexpr T& value() &;<br>
- constexpr T&& value() &&;<br>
- constexpr const T&& value() const &&;<br>
- template <class U> constexpr T value_or(U&&) const &;<br>
- template <class U> constexpr T value_or(U&&) &&;<br>
-<br>
- private:<br>
- T* val; // exposition only<br>
- };<br>
-<br>
- } // namespace fundamentals_v1<br>
- } // namespace experimental<br>
-<br>
- // 5.11, Hash support<br>
- template <class T> struct hash;<br>
- template <class T> struct hash<experimental::optional<T><wbr>>;<br>
-<br>
-} // namespace std<br>
-<br>
-*/<br>
-<br>
-#include <experimental/__config><br>
-#include <functional><br>
-#include <stdexcept><br>
-#if _LIBCPP_STD_VER > 11<br>
-#include <initializer_list><br>
-#include <type_traits><br>
-#include <new><br>
-#include <__functional_base><br>
-#include <__debug><br>
-#endif<br>
-<br>
-#if !defined(_LIBCPP_HAS_NO_<wbr>PRAGMA_SYSTEM_HEADER)<br>
-#pragma GCC system_header<br>
-#endif<br>
-<br>
-_LIBCPP_PUSH_MACROS<br>
-#include <__undef_macros><br>
-<br>
-<br>
-_LIBCPP_BEGIN_NAMESPACE_<wbr>EXPERIMENTAL<br>
-class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_<wbr>OPTIONAL_ACCESS bad_optional_access<br>
- : public std::logic_error<br>
-{<br>
-public:<br>
- bad_optional_access() : std::logic_error("Bad optional Access") {}<br>
-<br>
-// Get the key function ~bad_optional_access() into the dylib<br>
- virtual ~bad_optional_access() _NOEXCEPT;<br>
-};<br>
-<br>
-_LIBCPP_END_NAMESPACE_<wbr>EXPERIMENTAL<br>
-<br>
-<br>
-#if _LIBCPP_STD_VER > 11<br>
-<br>
-_LIBCPP_BEGIN_NAMESPACE_LFTS<br>
-<br>
-struct in_place_t {};<br>
-constexpr in_place_t in_place{};<br>
-<br>
-struct nullopt_t<br>
-{<br>
- explicit constexpr nullopt_t(int) noexcept {}<br>
-};<br>
-<br>
-constexpr nullopt_t nullopt{0};<br>
-<br>
-template <class _Tp, bool = is_trivially_destructible<_Tp><wbr>::value><br>
-class __optional_storage<br>
-{<br>
-protected:<br>
- typedef _Tp value_type;<br>
- union<br>
- {<br>
- char __null_state_;<br>
- value_type __val_;<br>
- };<br>
- bool __engaged_ = false;<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- ~__optional_storage()<br>
- {<br>
- if (__engaged_)<br>
- __val_.~value_type();<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr __optional_storage() noexcept<br>
- : __null_state_('\0') {}<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- __optional_storage(const __optional_storage& __x)<br>
- : __engaged_(__x.__engaged_)<br>
- {<br>
- if (__engaged_)<br>
- ::new((void*)_VSTD::addressof(<wbr>__val_)) value_type(__x.__val_);<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- __optional_storage(__optional_<wbr>storage&& __x)<br>
- noexcept(is_nothrow_move_<wbr>constructible<value_type>::<wbr>value)<br>
- : __engaged_(__x.__engaged_)<br>
- {<br>
- if (__engaged_)<br>
- ::new((void*)_VSTD::addressof(<wbr>__val_)) value_type(_VSTD::move(__x.__<wbr>val_));<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr __optional_storage(const value_type& __v)<br>
- : __val_(__v),<br>
- __engaged_(true) {}<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr __optional_storage(value_type&<wbr>& __v)<br>
- : __val_(_VSTD::move(__v)),<br>
- __engaged_(true) {}<br>
-<br>
- template <class... _Args><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr<br>
- explicit __optional_storage(in_place_t, _Args&&... __args)<br>
- : __val_(_VSTD::forward<_Args>(_<wbr>_args)...),<br>
- __engaged_(true) {}<br>
-};<br>
-<br>
-template <class _Tp><br>
-class __optional_storage<_Tp, true><br>
-{<br>
-protected:<br>
- typedef _Tp value_type;<br>
- union<br>
- {<br>
- char __null_state_;<br>
- value_type __val_;<br>
- };<br>
- bool __engaged_ = false;<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr __optional_storage() noexcept<br>
- : __null_state_('\0') {}<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- __optional_storage(const __optional_storage& __x)<br>
- : __engaged_(__x.__engaged_)<br>
- {<br>
- if (__engaged_)<br>
- ::new((void*)_VSTD::addressof(<wbr>__val_)) value_type(__x.__val_);<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- __optional_storage(__optional_<wbr>storage&& __x)<br>
- noexcept(is_nothrow_move_<wbr>constructible<value_type>::<wbr>value)<br>
- : __engaged_(__x.__engaged_)<br>
- {<br>
- if (__engaged_)<br>
- ::new((void*)_VSTD::addressof(<wbr>__val_)) value_type(_VSTD::move(__x.__<wbr>val_));<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr __optional_storage(const value_type& __v)<br>
- : __val_(__v),<br>
- __engaged_(true) {}<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr __optional_storage(value_type&<wbr>& __v)<br>
- : __val_(_VSTD::move(__v)),<br>
- __engaged_(true) {}<br>
-<br>
- template <class... _Args><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr<br>
- explicit __optional_storage(in_place_t, _Args&&... __args)<br>
- : __val_(_VSTD::forward<_Args>(_<wbr>_args)...),<br>
- __engaged_(true) {}<br>
-};<br>
-<br>
-template <class _Tp><br>
-class optional<br>
- : private __optional_storage<_Tp><br>
-{<br>
- typedef __optional_storage<_Tp> __base;<br>
-public:<br>
- typedef _Tp value_type;<br>
-<br>
- static_assert(!is_reference<<wbr>value_type>::value,<br>
- "Instantiation of optional with a reference type is ill-formed.");<br>
- static_assert(!is_same<<wbr>typename remove_cv<value_type>::type, in_place_t>::value,<br>
- "Instantiation of optional with a in_place_t type is ill-formed.");<br>
- static_assert(!is_same<<wbr>typename remove_cv<value_type>::type, nullopt_t>::value,<br>
- "Instantiation of optional with a nullopt_t type is ill-formed.");<br>
- static_assert(is_object<value_<wbr>type>::value,<br>
- "Instantiation of optional with a non-object type is undefined behavior.");<br>
- static_assert(is_nothrow_<wbr>destructible<value_type>::<wbr>value,<br>
- "Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}<br>
- _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;<br>
- _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;<br>
- _LIBCPP_INLINE_VISIBILITY ~optional() = default;<br>
- _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}<br>
- _LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)<br>
- : __base(__v) {}<br>
- _LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)<br>
- : __base(_VSTD::move(__v)) {}<br>
-<br>
- template <class... _Args,<br>
- class = typename enable_if<br>
- <<br>
- is_constructible<value_type, _Args...>::value<br>
- >::type<br>
- ><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr<br>
- explicit optional(in_place_t, _Args&&... __args)<br>
- : __base(in_place, _VSTD::forward<_Args>(__args).<wbr>..) {}<br>
-<br>
- template <class _Up, class... _Args,<br>
- class = typename enable_if<br>
- <<br>
- is_constructible<value_type, initializer_list<_Up>&, _Args...>::value<br>
- >::type<br>
- ><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr<br>
- explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)<br>
- : __base(in_place, __il, _VSTD::forward<_Args>(__args).<wbr>..) {}<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- optional& operator=(nullopt_t) noexcept<br>
- {<br>
- if (this->__engaged_)<br>
- {<br>
- this->__val_.~value_type();<br>
- this->__engaged_ = false;<br>
- }<br>
- return *this;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- optional&<br>
- operator=(const optional& __opt)<br>
- {<br>
- if (this->__engaged_ == __opt.__engaged_)<br>
- {<br>
- if (this->__engaged_)<br>
- this->__val_ = __opt.__val_;<br>
- }<br>
- else<br>
- {<br>
- if (this->__engaged_)<br>
- this->__val_.~value_type();<br>
- else<br>
- ::new((void*)_VSTD::addressof(<wbr>this->__val_)) value_type(__opt.__val_);<br>
- this->__engaged_ = __opt.__engaged_;<br>
- }<br>
- return *this;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- optional&<br>
- operator=(optional&& __opt)<br>
- noexcept(is_nothrow_move_<wbr>assignable<value_type>::value &&<br>
- is_nothrow_move_constructible<<wbr>value_type>::value)<br>
- {<br>
- if (this->__engaged_ == __opt.__engaged_)<br>
- {<br>
- if (this->__engaged_)<br>
- this->__val_ = _VSTD::move(__opt.__val_);<br>
- }<br>
- else<br>
- {<br>
- if (this->__engaged_)<br>
- this->__val_.~value_type();<br>
- else<br>
- ::new((void*)_VSTD::addressof(<wbr>this->__val_))<br>
- value_type(_VSTD::move(__opt._<wbr>_val_));<br>
- this->__engaged_ = __opt.__engaged_;<br>
- }<br>
- return *this;<br>
- }<br>
-<br>
- template <class _Up,<br>
- class = typename enable_if<br>
- <<br>
- is_same<typename remove_reference<_Up>::type, value_type>::value &&<br>
- is_constructible<value_type, _Up>::value &&<br>
- is_assignable<value_type&, _Up>::value<br>
- >::type<br>
- ><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- optional&<br>
- operator=(_Up&& __v)<br>
- {<br>
- if (this->__engaged_)<br>
- this->__val_ = _VSTD::forward<_Up>(__v);<br>
- else<br>
- {<br>
- ::new((void*)_VSTD::addressof(<wbr>this->__val_)) value_type(_VSTD::forward<_Up><wbr>(__v));<br>
- this->__engaged_ = true;<br>
- }<br>
- return *this;<br>
- }<br>
-<br>
- template <class... _Args,<br>
- class = typename enable_if<br>
- <<br>
- is_constructible<value_type, _Args...>::value<br>
- >::type<br>
- ><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- void<br>
- emplace(_Args&&... __args)<br>
- {<br>
- *this = nullopt;<br>
- ::new((void*)_VSTD::addressof(<wbr>this->__val_))<br>
- value_type(_VSTD::forward<_<wbr>Args>(__args)...);<br>
- this->__engaged_ = true;<br>
- }<br>
-<br>
- template <class _Up, class... _Args,<br>
- class = typename enable_if<br>
- <<br>
- is_constructible<value_type, initializer_list<_Up>&, _Args...>::value<br>
- >::type<br>
- ><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- void<br>
- emplace(initializer_list<_Up> __il, _Args&&... __args)<br>
- {<br>
- *this = nullopt;<br>
- ::new((void*)_VSTD::addressof(<wbr>this->__val_))<br>
- value_type(__il, _VSTD::forward<_Args>(__args).<wbr>..);<br>
- this->__engaged_ = true;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- void<br>
- swap(optional& __opt)<br>
- noexcept(is_nothrow_move_<wbr>constructible<value_type>::<wbr>value &&<br>
- __is_nothrow_swappable<value_<wbr>type>::value)<br>
- {<br>
- using _VSTD::swap;<br>
- if (this->__engaged_ == __opt.__engaged_)<br>
- {<br>
- if (this->__engaged_)<br>
- swap(this->__val_, __opt.__val_);<br>
- }<br>
- else<br>
- {<br>
- if (this->__engaged_)<br>
- {<br>
- ::new((void*)_VSTD::addressof(<wbr>__opt.__val_))<br>
- value_type(_VSTD::move(this->_<wbr>_val_));<br>
- this->__val_.~value_type();<br>
- }<br>
- else<br>
- {<br>
- ::new((void*)_VSTD::addressof(<wbr>this->__val_))<br>
- value_type(_VSTD::move(__opt._<wbr>_val_));<br>
- __opt.__val_.~value_type();<br>
- }<br>
- swap(this->__engaged_, __opt.__engaged_);<br>
- }<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr<br>
- value_type const*<br>
- operator->() const<br>
- {<br>
- _LIBCPP_ASSERT(this->__<wbr>engaged_, "optional operator-> called for disengaged value");<br>
-#ifndef _LIBCPP_HAS_NO_BUILTIN_<wbr>ADDRESSOF<br>
- return __builtin_addressof(this->__<wbr>val_);<br>
-#else<br>
- return __operator_arrow(__has_<wbr>operator_addressof<value_type><wbr>{});<br>
-#endif<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- value_type*<br>
- operator->()<br>
- {<br>
- _LIBCPP_ASSERT(this->__<wbr>engaged_, "optional operator-> called for disengaged value");<br>
- return _VSTD::addressof(this->__val_)<wbr>;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr<br>
- const value_type&<br>
- operator*() const<br>
- {<br>
- _LIBCPP_ASSERT(this->__<wbr>engaged_, "optional operator* called for disengaged value");<br>
- return this->__val_;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- value_type&<br>
- operator*()<br>
- {<br>
- _LIBCPP_ASSERT(this->__<wbr>engaged_, "optional operator* called for disengaged value");<br>
- return this->__val_;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr explicit operator bool() const noexcept {return this->__engaged_;}<br>
-<br>
- _LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY<br>
-#ifndef _LIBCPP_NO_EXCEPTIONS<br>
-_LIBCPP_AVAILABILITY_BAD_<wbr>OPTIONAL_ACCESS<br>
-#endif<br>
- constexpr void __throw_bad_optional_access() const<br>
- {<br>
-#ifndef _LIBCPP_NO_EXCEPTIONS<br>
- throw bad_optional_access();<br>
-#else<br>
- _VSTD::abort();<br>
-#endif<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_<wbr>OPTIONAL_ACCESS<br>
- constexpr value_type const& value() const<br>
- {<br>
- if (!this->__engaged_)<br>
- __throw_bad_optional_access();<br>
- return this->__val_;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_<wbr>OPTIONAL_ACCESS<br>
- value_type& value()<br>
- {<br>
- if (!this->__engaged_)<br>
- __throw_bad_optional_access();<br>
- return this->__val_;<br>
- }<br>
-<br>
- template <class _Up><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr value_type value_or(_Up&& __v) const&<br>
- {<br>
- static_assert(is_copy_<wbr>constructible<value_type>::<wbr>value,<br>
- "optional<T>::value_or: T must be copy constructible");<br>
- static_assert(is_convertible<_<wbr>Up, value_type>::value,<br>
- "optional<T>::value_or: U must be convertible to T");<br>
- return this->__engaged_ ? this->__val_ :<br>
- static_cast<value_type>(_VSTD:<wbr>:forward<_Up>(__v));<br>
- }<br>
-<br>
- template <class _Up><br>
- _LIBCPP_INLINE_VISIBILITY<br>
- value_type value_or(_Up&& __v) &&<br>
- {<br>
- static_assert(is_move_<wbr>constructible<value_type>::<wbr>value,<br>
- "optional<T>::value_or: T must be move constructible");<br>
- static_assert(is_convertible<_<wbr>Up, value_type>::value,<br>
- "optional<T>::value_or: U must be convertible to T");<br>
- return this->__engaged_ ? _VSTD::move(this->__val_) :<br>
- static_cast<value_type>(_VSTD:<wbr>:forward<_Up>(__v));<br>
- }<br>
-<br>
-private:<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- value_type const*<br>
- __operator_arrow(true_type) const<br>
- {<br>
- return _VSTD::addressof(this->__val_)<wbr>;<br>
- }<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- constexpr<br>
- value_type const*<br>
- __operator_arrow(false_type) const<br>
- {<br>
- return &this->__val_;<br>
- }<br>
-};<br>
-<br>
-// Comparisons between optionals<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)<br>
-{<br>
- if (static_cast<bool>(__x) != static_cast<bool>(__y))<br>
- return false;<br>
- if (!static_cast<bool>(__x))<br>
- return true;<br>
- return *__x == *__y;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)<br>
-{<br>
- return !(__x == __y);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)<br>
-{<br>
- if (!static_cast<bool>(__y))<br>
- return false;<br>
- if (!static_cast<bool>(__x))<br>
- return true;<br>
- return *__x < *__y;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)<br>
-{<br>
- return __y < __x;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)<br>
-{<br>
- return !(__y < __x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)<br>
-{<br>
- return !(__x < __y);<br>
-}<br>
-<br>
-<br>
-// Comparisons with nullopt<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator==(const optional<_Tp>& __x, nullopt_t) noexcept<br>
-{<br>
- return !static_cast<bool>(__x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator==(nullopt_t, const optional<_Tp>& __x) noexcept<br>
-{<br>
- return !static_cast<bool>(__x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator!=(const optional<_Tp>& __x, nullopt_t) noexcept<br>
-{<br>
- return static_cast<bool>(__x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator!=(nullopt_t, const optional<_Tp>& __x) noexcept<br>
-{<br>
- return static_cast<bool>(__x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<(const optional<_Tp>&, nullopt_t) noexcept<br>
-{<br>
- return false;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<(nullopt_t, const optional<_Tp>& __x) noexcept<br>
-{<br>
- return static_cast<bool>(__x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<=(const optional<_Tp>& __x, nullopt_t) noexcept<br>
-{<br>
- return !static_cast<bool>(__x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<=(nullopt_t, const optional<_Tp>&) noexcept<br>
-{<br>
- return true;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>(const optional<_Tp>& __x, nullopt_t) noexcept<br>
-{<br>
- return static_cast<bool>(__x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>(nullopt_t, const optional<_Tp>&) noexcept<br>
-{<br>
- return false;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>=(const optional<_Tp>&, nullopt_t) noexcept<br>
-{<br>
- return true;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>=(nullopt_t, const optional<_Tp>& __x) noexcept<br>
-{<br>
- return !static_cast<bool>(__x);<br>
-}<br>
-<br>
-// Comparisons with T<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator==(const optional<_Tp>& __x, const _Tp& __v)<br>
-{<br>
- return static_cast<bool>(__x) ? *__x == __v : false;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator==(const _Tp& __v, const optional<_Tp>& __x)<br>
-{<br>
- return static_cast<bool>(__x) ? *__x == __v : false;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator!=(const optional<_Tp>& __x, const _Tp& __v)<br>
-{<br>
- return static_cast<bool>(__x) ? !(*__x == __v) : true;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator!=(const _Tp& __v, const optional<_Tp>& __x)<br>
-{<br>
- return static_cast<bool>(__x) ? !(*__x == __v) : true;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<(const optional<_Tp>& __x, const _Tp& __v)<br>
-{<br>
- return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<(const _Tp& __v, const optional<_Tp>& __x)<br>
-{<br>
- return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<=(const optional<_Tp>& __x, const _Tp& __v)<br>
-{<br>
- return !(__x > __v);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator<=(const _Tp& __v, const optional<_Tp>& __x)<br>
-{<br>
- return !(__v > __x);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>(const optional<_Tp>& __x, const _Tp& __v)<br>
-{<br>
- return static_cast<bool>(__x) ? __v < __x : false;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>(const _Tp& __v, const optional<_Tp>& __x)<br>
-{<br>
- return static_cast<bool>(__x) ? __x < __v : true;<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>=(const optional<_Tp>& __x, const _Tp& __v)<br>
-{<br>
- return !(__x < __v);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-bool<br>
-operator>=(const _Tp& __v, const optional<_Tp>& __x)<br>
-{<br>
- return !(__v < __x);<br>
-}<br>
-<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-void<br>
-swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__<wbr>y)))<br>
-{<br>
- __x.swap(__y);<br>
-}<br>
-<br>
-template <class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
-constexpr<br>
-optional<typename decay<_Tp>::type><br>
-make_optional(_Tp&& __v)<br>
-{<br>
- return optional<typename decay<_Tp>::type>(_VSTD::<wbr>forward<_Tp>(__v));<br>
-}<br>
-<br>
-_LIBCPP_END_NAMESPACE_LFTS<br>
-<br>
-_LIBCPP_BEGIN_NAMESPACE_STD<br>
-<br>
-template <class _Tp><br>
-struct _LIBCPP_TEMPLATE_VIS hash<std::experimental::<wbr>optional<_Tp> ><br>
-{<br>
- typedef std::experimental::optional<_<wbr>Tp> argument_type;<br>
- typedef size_t result_type;<br>
-<br>
- _LIBCPP_INLINE_VISIBILITY<br>
- result_type operator()(const argument_type& __opt) const _NOEXCEPT<br>
- {<br>
- return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;<br>
- }<br>
-};<br>
-<br>
-_LIBCPP_END_NAMESPACE_STD<br>
-<br>
-#endif // _LIBCPP_STD_VER > 11<br>
-<br>
-_LIBCPP_POP_MACROS<br>
-<br>
-#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL<br>
+#error "<experimental/optional> has been removed. Use <optional> instead."<br>
<br>
Modified: libcxx/trunk/include/module.<wbr>modulemap<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/module.modulemap?rev=323971&r1=323970&r2=323971&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/include/<wbr>module.modulemap?rev=323971&<wbr>r1=323970&r2=323971&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/include/module.<wbr>modulemap (original)<br>
+++ libcxx/trunk/include/module.<wbr>modulemap Thu Feb 1 06:54:25 2018<br>
@@ -546,10 +546,6 @@ module std [system] {<br>
header "experimental/numeric"<br>
export *<br>
}<br>
- module optional {<br>
- header "experimental/optional"<br>
- export *<br>
- }<br>
module propagate_const {<br>
header "experimental/propagate_const"<br>
export *<br>
<br>
Modified: libcxx/trunk/src/optional.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/optional.cpp?rev=323971&r1=323970&r2=323971&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/src/<wbr>optional.cpp?rev=323971&r1=<wbr>323970&r2=323971&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/src/optional.cpp (original)<br>
+++ libcxx/trunk/src/optional.cpp Thu Feb 1 06:54:25 2018<br>
@@ -8,7 +8,6 @@<br>
//===-------------------------<wbr>------------------------------<wbr>---------------===//<br>
<br>
#include "optional"<br>
-#include "experimental/optional"<br>
<br>
namespace std<br>
{<br>
@@ -21,8 +20,3 @@ const char* bad_optional_access::what()<br>
<br>
} // std<br>
<br>
-_LIBCPP_BEGIN_NAMESPACE_<wbr>EXPERIMENTAL<br>
-<br>
-bad_optional_access::~bad_<wbr>optional_access() _NOEXCEPT = default;<br>
-<br>
-_LIBCPP_END_NAMESPACE_<wbr>EXPERIMENTAL<br>
<br>
Modified: libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/double_include.sh.cpp?rev=323971&r1=323970&r2=323971&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/<wbr>libcxx/double_include.sh.cpp?<wbr>rev=323971&r1=323970&r2=<wbr>323971&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/<wbr>double_include.sh.cpp Thu Feb 1 06:54:25 2018<br>
@@ -150,7 +150,6 @@<br>
#include <experimental/map><br>
#include <experimental/memory_resource><br>
#include <experimental/numeric><br>
-#include <experimental/optional><br>
#include <experimental/propagate_const><br>
#include <experimental/ratio><br>
#include <experimental/regex><br>
<br>
Modified: libcxx/trunk/test/libcxx/min_<wbr>max_macros.sh.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/min_max_macros.sh.cpp?rev=323971&r1=323970&r2=323971&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/libcxx/trunk/test/<wbr>libcxx/min_max_macros.sh.cpp?<wbr>rev=323971&r1=323970&r2=<wbr>323971&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- libcxx/trunk/test/libcxx/min_<wbr>max_macros.sh.cpp (original)<br>
+++ libcxx/trunk/test/libcxx/min_<wbr>max_macros.sh.cpp Thu Feb 1 06:54:25 2018<br>
@@ -261,8 +261,6 @@ TEST_MACROS();<br>
TEST_MACROS();<br>
#include <experimental/numeric><br>
TEST_MACROS();<br>
-#include <experimental/optional><br>
-TEST_MACROS();<br>
#include <experimental/propagate_const><br>
TEST_MACROS();<br>
#include <experimental/ratio><br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>