summaryrefslogtreecommitdiff
path: root/include/optional
AgeCommit message (Collapse)Author
2018-01-02Implement most of P0607: Inline Variables for the Standard Library. This ↵Marshall Clow
involved marking a lot of variables as inline (but only for C++17 and later). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@321658 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01Update the synopsis to match the P/R of 2945. No code changes.Marshall Clow
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@317063 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09optional: Implement LWG 2900 and P0602Casey Carter
Differential Revision: https://reviews.llvm.org/D32385 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06add missing constexpr to optional::value_orCasey Carter
[Credit to cpplearner] Differential Revision: https://reviews.llvm.org/D27850 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-31[Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier
Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-17Mark the copy constructor and move Marshall Clow
constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17[optional] Update synopsis for LWG2934Casey Carter
(comment-only change) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12Implement part of LWG#2857 - any/optional. Still to do - variant. Reviewed ↵Marshall Clow
as https://reviews.llvm.org/D31956 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300123 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30Fix LWG 2934 - optional<const T> doesn't compare with TEric Fiselier
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>Eric Fiselier
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299100 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23Implement P0599: 'noexcept for hash functions'. Fix a couple of hash ↵Marshall Clow
functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298573 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05Restore the _NOEXCEPT on the dtor of bad_optional_access. Destructors are ↵Marshall Clow
noexcept by default, so it's not really needed, but the other exception classes have the _NOEXCEPT, and gcc complains if these are missing. I think we should remove them all - but not today. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294142 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-05Change the base class of std::bad_optional_access. This is a (subtle) ABI ↵Marshall Clow
change, and is in response to http://http://wg21.link/LWG2806, which I *expect* to be adopted in Kona. I am making this change now in anticipation, and will get it into 4.0, because (a) 4.0 is the first release with std::optional, and (b) I don't want to make an ABI-change later, when the user base should be significantly larger. Note that I didn't change std::experimental::bad_optional_access, because that's still specified to derive from std::logic_error. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294133 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-21Implement P0513R0 - "Poisoning the Hash"Eric Fiselier
Summary: Exactly what the title says. This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it. See http://wg21.link/P0513R0 for more info. If there are no comments in the next couple of days I'll commit this Reviewers: mclow.lists, K-ballo, EricWF Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28938 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292684 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04[NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier
The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-31remove some inherited attributes on exceptionsSaleem Abdulrasool
These exception types are marked with `_LIBCPP_EXCEPTION_ABI` which expands to `__attribute__((__visibility__("default")))` or `__declspec(dllexport)`. When building for Windows, we would hit an error: cannot apply 'dllexport' to a 'dllexport' class Remove the duplicate annotations as they will be inherited from the class. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290785 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23Fix unused parameters and variablesEric Fiselier
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16Update status for std::optional LWG issues and fix an optional SFINAE bugEric Fiselier
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12Implement N4606 optionalEric Fiselier
Summary: Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional. - Update relational operators per http://wg21.link/P0307 - Update to requirements of http://wg21.link/P0032 - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable. Audit P/Rs for optional LWG issues: - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R). - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression. - 2740 "constexpr optional<T>::operator->" Already conforming. - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented. - 2748 "swappable traits for optionals" Already conforming. - 2753 "Optional's constructors and assignments need constraints" Implemented. Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey! Reviewers: mclow.lists, CaseyCarter, EricWF Differential Revision: https://reviews.llvm.org/D22741 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283980 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12Revert Add <optional>. Will recommit with better commit messageEric Fiselier
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283978 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12Add <optional> header.Eric Fiselier
This patch is largely thanks to Casey Carter @ Microsoft. He did the initial work of porting our experimental implementation and tests over to namespace std. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283977 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15Move <optional> into include/experimental, and into the std::experimental ↵Marshall Clow
namespace, since it's not part of C++14, but of an upcoming TS git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194867 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-02Implement N3672, optional<T>.Howard Hinnant
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189772 91177308-0d34-0410-b5e6-96231b3b80d8