summaryrefslogtreecommitdiffstats
path: root/libcxx/include/array
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Fix recursive instantiation in std::array.Eric Fiselier2020-06-261-1/+1
| | | | | | | | | | | | | | The use of the `&& ...` fold expression in std::array's deduction guides recursively builds a set of binary operator expressions of depth N where `N` is the number of elements in the initializer. This is problematic because arrays may be large, and instantiation depth is limited. This patch addresses the issue by flattening the SFINAE using the existing `__all` type trait. (cherry picked from commit c6eb584c64872fbb779df14acd31c1f3947f6e52)
* [libc++] Declare std::tuple_element as struct instead of classLouis Dionne2019-04-011-3/+2
| | | | | | | | | | | | Similarly to https://reviews.llvm.org/rL350972, this revision changes std::tuple_element from class to struct. Fixes PR41331. Thanks to Jan Wilken Dörrie for the patch. Differential Revision: https://reviews.llvm.org/D60069 llvm-svn: 357411
* Mark 'front()' and 'back()' as noexcept for array/deque/string/string_view. ↵Marshall Clow2019-03-191-8/+8
| | | | | | These are just rebranded 'operator[]', and should be noexcept like it is. llvm-svn: 356435
* Add noexcept to operator[] for array and deque. This is an extension. We ↵Marshall Clow2019-03-141-4/+4
| | | | | | already do this for string and string_view. This should give better codegen inside of noexcept functions. llvm-svn: 356209
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Change from a to a . Fixes PR#39871.Marshall Clow2019-01-111-2/+2
| | | | llvm-svn: 350972
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-121-0/+1
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* Implement P1023: constexpr comparison operators for std::arrayMarshall Clow2018-08-021-6/+6
| | | | llvm-svn: 338668
* Implement deduction guides for <array>; Reviewed as ↵Marshall Clow2018-05-181-1/+12
| | | | | | https://reviews.llvm.org/D46964 llvm-svn: 332768
* Fix size and alignment of array<T, 0>.Eric Fiselier2018-02-071-2/+3
| | | | | | | | An array T[1] isn't necessarily the same say when it's a member of a struct. This patch addresses that problem and corrects the tests to deal with it. llvm-svn: 324545
* [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default ↵Eric Fiselier2018-02-071-20/+147
| | | | | | | | | | | | | | | | | | | constructible types. Summary: This patch fixes llvm.org/PR35491 and LWG2157 (https://cplusplus.github.io/LWG/issue2157) The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: lichray, cfe-commits Differential Revision: https://reviews.llvm.org/D41223 llvm-svn: 324526
* Revert "[libc++] Fix PR35491 - std::array of zero-size doesn't work with ↵Nirav Dave2018-02-061-70/+17
| | | | | | | | | | | non-default constructible types." Revert "Fix initialization of array<const T, 0> with GCC." Revert "Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed." This reverts commit r324182, r324185, and r324194 which were causing issues with zero-length std::arrays. llvm-svn: 324309
* Fix initialization of array<const T, 0> with GCC.Eric Fiselier2018-02-041-8/+6
| | | | | | | | | | | | Previously, when handling zero-sized array of const objects we used a const version of aligned_storage_t, which is not an array type. However, GCC complains about initialization of the form: array<const T, 0> arr = {}; This patch fixes that bug by making the dummy object used to represent the zero-sized array an array itself. This avoids GCC's complaints about the uninitialized const member. llvm-svn: 324194
* Make array<const T, 0> non-CopyAssignable and make swap and fill ill-formed.Eric Fiselier2018-02-041-10/+21
| | | | | | | | | | | | The standard isn't exactly clear how std::array should handle zero-sized arrays with const element types. In particular W.R.T. copy assignment, swap, and fill. This patch takes the position that those operations should be ill-formed, and makes changes to libc++ to make it so. This follows up on commit r324182. llvm-svn: 324185
* [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default ↵Eric Fiselier2018-02-041-16/+60
| | | | | | | | | | | | | | | | | | | constructible types. Summary: This patch fixes llvm.org/PR35491 and LWG2157 (https://cplusplus.github.io/LWG/issue2157) The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: lichray, cfe-commits Differential Revision: https://reviews.llvm.org/D41223 llvm-svn: 324182
* First part of P0600 - '[[nodiscard] in the standard library'. Mark the ↵Marshall Clow2017-11-151-1/+1
| | | | | | 'empty()' methods of all the containers as nodiscard. If you're calling empty() w/o looking at the result, you probably meanto to call 'clear()'. c++2a only llvm-svn: 318269
* [array.tuple]/1 says that instantiating tuple_element<N, array<T, M>> is ↵Marshall Clow2017-06-121-0/+1
| | | | | | ill-formed if N >= M. We didn't do that. Add a static_assert to cause a failure, and a test that checks that we failed llvm-svn: 305191
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-0/+2
| | | | | | | | | | | | | | | | 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 llvm-svn: 304357
* Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in <array>Eric Fiselier2017-04-161-2/+2
| | | | llvm-svn: 300412
* Implement the missing constexpr stuff in <array>. Fixes PR#31645.Marshall Clow2017-01-161-5/+9
| | | | llvm-svn: 292091
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-3/+3
| | | | | | | | | | | | | 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. llvm-svn: 291035
* Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to ↵Marshall Clow2017-01-041-14/+14
| | | | | | reverse_iterator, move_iterator, array and Range Access' for C++17 llvm-svn: 290976
* Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-13/+3
| | | | | | type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855. llvm-svn: 279744
* Add is_swappable/is_nothrow_swappable traitsEric Fiselier2016-04-211-4/+12
| | | | llvm-svn: 267079
* non-member swap for array was mistakenly taking const ref params. Fixed and ↵Marshall Clow2016-03-071-1/+1
| | | | | | added test. Thanks to Ben Craig for the catch llvm-svn: 262866
* [libcxx] LWG2485: get() should be overloaded for const tuple&&. Patch from ↵Eric Fiselier2015-12-181-0/+10
| | | | | | | K-Ballo. Review: http://reviews.llvm.org/D14839 llvm-svn: 255941
* Fix some mistakes in the <array> synopsis. No functional change. Thanks to ↵Marshall Clow2015-11-191-5/+5
| | | | | | K-ballo for the patch llvm-svn: 253592
* [libcxx] Move tuple_size and tuple_element overloads for pair and array out ↵Eric Fiselier2015-03-171-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of !defined(_LIBCPP_HAS_NO_VARIADICS) block. Summary: There is no reason to guard `tuple_size`, `tuple_element` and `get<I>(...)` for pair and array inside of `<__tuple>` so that they are only available when we have variadic templates. This requires there be redundant declarations and definitions. It also makes it easy to get things wrong. For example the following code should compile (and does in c++11). ``` #define _LIBCPP_HAS_NO_VARIADICS #include <array> int main() { static_assert((std::tuple_size<std::array<int, 10> volatile>::value == 10), ""); } ``` This patch lifts the non-variadic parts of `tuple_size`, `tuple_types`, and `get<I>(...)` to the top of `<__tuple>` where they don't require variadic templates. This patch also removes `<__tuple_03>` because there is no longer a need for it. Reviewers: danalbert, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7774 llvm-svn: 232492
* G M: Changes all references to "x inline" to "inline x" where x = ↵Howard Hinnant2013-10-041-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | _libcpp_always_inline or _libcpp_inline_visibility macros. The patch touches these files: locale array deque new string utility vector __bit_reference __split_buffer locale_win32.h There is no intended functionality change and it is expected that reversing the position of the inline keyword with regard to the other keywords does not change the meaning of anything, least not for apple/Linux etc. It is intended to make libcxx more consistent with itself and to prevent the 1000 or so "inline.cpp(3) : warning C4141: 'inline' : used more than once" warnings that MS's cl.exe compiler emits without this patch, i.e. if inline is not the first keyword before a function name etc. Prefer "inline [other inline related keyword]" over "[other related keyword] inline". After this patch, libcxx should be consistent to this pattern. llvm-svn: 191987
* Nico Rieck: this patch series fixes visibility issues on Windows as ↵Howard Hinnant2013-08-121-5/+5
| | | | | | explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. llvm-svn: 188192
* Make std::get constexprMarshall Clow2013-07-171-17/+18
| | | | llvm-svn: 186525
* No functionality change at this time. I've split _LIBCPP_VISIBLE up into ↵Howard Hinnant2013-03-061-5/+5
| | | | | | two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute. llvm-svn: 176593
* Added static_assert to std::get<N>(std::array) calls to catch "out of ↵Marshall Clow2012-12-181-0/+3
| | | | | | bounds" calls llvm-svn: 170435
* constexpr applied to <array>.Howard Hinnant2012-07-201-4/+4
| | | | llvm-svn: 160564
* Windows support by Ruben Van Boxem.Howard Hinnant2011-10-171-0/+2
| | | | llvm-svn: 142235
* _STD -> _VSTD to avoid macro clash on windowsHoward Hinnant2011-06-301-5/+5
| | | | llvm-svn: 134190
* Experimental support for a meaningful __is_swappable<T>::value. This does ↵Howard Hinnant2011-06-011-1/+5
| | | | | | not appear to be strictly needed for correct functioning of the library. If it causes any problems, I'd rather pull it sooner rather than later. llvm-svn: 132421
* noexcept for <array>.Howard Hinnant2011-05-311-45/+64
| | | | llvm-svn: 132359
* LWG 1191Howard Hinnant2010-11-171-0/+13
| | | | llvm-svn: 119545
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* visibility-decoration.Howard Hinnant2010-09-211-7/+11
| | | | llvm-svn: 114470
* Fixing whitespace problemsHoward Hinnant2010-08-221-90/+90
| | | | llvm-svn: 111750
* Wiped out some non-ascii characters that snuck into the copyright.Howard Hinnant2010-05-111-1/+1
| | | | llvm-svn: 103516
* libcxx initial importHoward Hinnant2010-05-111-0/+296
llvm-svn: 103490
OpenPOWER on IntegriCloud