summaryrefslogtreecommitdiffstats
path: root/libcxx/include/iterator
Commit message (Collapse)AuthorAgeFilesLines
* Rename __is_foo_iterator traits to reflect their Cpp17 nature.Eric Fiselier2019-11-181-11/+15
| | | | | | | | | With the upcoming introduction of iterator concepts in ranges, the meaning of "__is_contiguous_iterator" changes drastically. Currently we intend it to mean "does it have this iterator category", but it could now also mean "does it meet the requirements of this concept", and these can be different.
* [libc++] Add _ITER_CONCEPT and _ITER_TRAITS implementations from C++20Eric Fiselier2019-11-161-1/+52
| | | | | | These traits are currently unused because we don't implement ranges. However, their addition is part of ongoing work to allow libc++ to optimize on user-provided contiguous iterators.
* [libc++] Add C++20 contiguous_iterator_tag.Eric Fiselier2019-11-161-0/+13
| | | | | This work is part of an ongoing effort to allow libc++ to optimize user provided contiguous iterators.
* [libc++][P0202] Marked algorithms copy/copy_n/copy_if/copy_backward constexprLouis Dionne2019-11-061-4/+4
| | | | | | Thanks to Michael Park for the patch. Differential Revision: https://reviews.llvm.org/D68837
* Revert "Suppress -Wctad-maybe-unsupported on types w/o deduction guides."Eric Fiselier2019-08-041-1/+0
| | | | | | | | | Some modules builds are issuing buggy diagnostics. The cause of which is TBD. This reverts commit r@367770. llvm-svn: 367777
* Suppress -Wctad-maybe-unsupported on types w/o deduction guides.Eric Fiselier2019-08-031-0/+1
| | | | | | | | | | | There are a handful of standard library types that are intended to support CTAD but don't need any explicit deduction guides to do so. This patch adds a dummy deduction guide to those types to suppress -Wctad-maybe-unsupported (which gets emitted in user code). llvm-svn: 367770
* [libc++] Take 2: Implement CTAD for map and multimapLouis Dionne2019-06-201-0/+16
| | | | | | | | | | | This is a re-application of r362986 (which was reverted in r363688) with fixes for the issue that caused it to be reverted. Thanks to Arthur O'Dwyer for the patch. Differential Revision: https://reviews.llvm.org/D58587 llvm-svn: 363968
* [libc++] Revert the addition of map/multimap CTADLouis Dionne2019-06-181-16/+0
| | | | | | | | | | | | | This was found to be broken on Clang trunk. This is a revert of the following commits (the subsequent commits added XFAILs to the tests that were missing from the original submission): r362986: Implement deduction guides for map/multimap. r363014: Add some XFAILs r363097: Add more XFAILs r363197: Add even more XFAILs llvm-svn: 363688
* Implement deduction guides for map/multimap. Reviewed as ↵Marshall Clow2019-06-101-0/+16
| | | | | | https://reviews.llvm.org/D58587. Thanks to Quuxplusone for the submission. llvm-svn: 362986
* [NFC][libcxx] Remove trailing whitespaceLouis Dionne2019-05-291-15/+15
| | | | | | It's incredibly annoying when trying to create diffs llvm-svn: 361981
* [libc++] Unconditionally enable the __pad_and_output optimizationLouis Dionne2019-04-181-5/+0
| | | | | | | | | | This used to be guarded on whether the deployment target was greater than macosx10.8, however testing against the dylibs for 10.8 and earlier with the function enabled works too. The revision that introduced __pad_and_output is r164241 and it does not mention a reason for the guard. llvm-svn: 358677
* Fix a minor bug with std::next and prev not and negative numbers. In ↵Marshall Clow2019-03-221-5/+12
| | | | | | particular, std::prev cannot require Bidirectional Iterators, because you might 'go back' -1 places, which goes forward. Thanks to Ville and Jonathan for the bug report. llvm-svn: 356818
* Remove exception throwing debug mode handler support.Eric Fiselier2019-03-181-46/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The reason libc++ implemented a throwing debug mode handler was for ease of testing. Specifically, I thought that if a debug violation aborted, we could only test one violation per file. This made it impossible to test debug mode. Which throwing behavior we could test more! However, the throwing approach didn't work either, since there are debug violations underneath noexcept functions. This lead to the introduction of `_NOEXCEPT_DEBUG`, which was only noexcept when debug mode was off. Having thought more and having grown wiser, `_NOEXCEPT_DEBUG` was a horrible decision. It was viral, it didn't cover all the cases it needed to, and it was observable to the user -- at worst changing the behavior of their program. This patch removes the throwing debug handler, and rewrites the debug tests using 'fork-ing' style death tests. Reviewers: mclow.lists, ldionne, thomasanderson Reviewed By: ldionne Subscribers: christof, arphaman, libcxx-commits, #libc Differential Revision: https://reviews.llvm.org/D59166 llvm-svn: 356417
* In the review of D58642, Louis asked: 'Is there a reason for making this ↵Marshall Clow2019-02-271-33/+33
| | | | | | inline? Templates are already inline by default'. I told him that I didn't want to change the one call (ssize) that I was adding, but would come back later and clean them all (data/empty/begin/end/cbegin/cend/rbegin/rend/crbegin/crend/size/ssize) up later. Now it is later. Remove the unnecessary 'inline' modifiers from all these calls. llvm-svn: 354952
* Implement the second part of P1227R2 - Signed ssize() functions. Reviewed as ↵Marshall Clow2019-02-271-0/+18
| | | | | | https://reviews.llvm.org/D58642 llvm-svn: 354950
* First part of P1227R2 - change span over to use 'size_t' instead of ↵Marshall Clow2019-02-271-1/+1
| | | | | | 'ptrdiff_t'. Reviewed as https://reviews.llvm.org/D58639. llvm-svn: 354936
* 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
* Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric ↵Marshall Clow2018-11-131-1/+18
| | | | | | for the report llvm-svn: 346738
* 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
* Mark one more __wrap_iter operation as constexpr.Marshall Clow2018-07-141-1/+2
| | | | llvm-svn: 337085
* Make internal class __wrap_iter constexpr when not using libc++'s debugging ↵Marshall Clow2018-07-131-54/+56
| | | | | | mode. Introduce a new macro _LIBCPP_CONSTEXPR_IF_NODEBUG to mark this. llvm-svn: 337019
* [libcxx] Define istream_iterator equality comparison operators out-of-lineRoger Ferrer Ibanez2017-12-111-4/+26
| | | | | | | | | | | | | | | | | Currently libc++ defines operator== and operator!= as friend functions in the definition of the istream_iterator class template. Such definition has a subtle difference from an out-of-line definition required by the C++ Standard: these functions can only be found by argument-dependent lookup, but not by qualified lookup. This patch changes the definition, so that it conforms to the C++ Standard and adds a check involving qualified lookup to the test suite. Patch contributed by Mikhail Maltsev. Differential Revision: https://reviews.llvm.org/D40415 llvm-svn: 320363
* Mark free functions size/empty/data conditionally noexcept.Marshall Clow2017-11-161-4/+31
| | | | llvm-svn: 318432
* More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in ↵Marshall Clow2017-11-151-0/+9
| | | | | | string, string_view, and the free function std::empty(). Removed tabs from <string_view>, which is why the diff is so big. llvm-svn: 318328
* Implement LWG2952: iterator_traits should work for pointers to cv TMarshall Clow2017-11-141-11/+1
| | | | llvm-svn: 318119
* Remove addtional parameters in function std::next() and std::prev()Rachel Craik2017-07-241-8/+14
| | | | | | | | | | | Creating a function pointer with proper parameters pointing to std::next() or std::prev() should work. This change moves the invented paramater for enable_if over to the return type to resolve this QoI issue. Patch by Jason Liu. Differential Revision: https://reviews.llvm.org/D34649 llvm-svn: 308932
* Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did ↵Marshall Clow2017-05-231-1/+0
| | | | | | anything useful. llvm-svn: 303675
* Make next/prev/advance/distance operations on iterators be constexpr. I ↵Marshall Clow2017-05-171-14/+23
| | | | | | missed this when I implemented the rest of P0031R0 llvm-svn: 303281
* Cleanup usages of _LIBCPP_HAS_NO_<c++11-feature> in <bitset>, <ios>, ↵Eric Fiselier2017-04-191-7/+7
| | | | | | <locale>, and <iterator> llvm-svn: 300648
* Diagnose when reverse_iterator is used on path::iterator.Eric Fiselier2017-04-131-0/+13
| | | | | | | | | | | | | | | path::iterator isn't a strictly conforming iterator. Specifically it stashes the current element inside the iterator. This leads to UB when used with reverse_iterator since it requires the element to outlive the lifetime of the iterator. This patch adds a static_assert inside reverse_iterator to disallow "stashing iterator types", and it tags path::iterator as such a type. Additionally this patch removes all uses of reverse_iterator<path::iterator> within the tests. llvm-svn: 300164
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-18/+18
| | | | | | | | | | | | | 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-33/+33
| | | | | | reverse_iterator, move_iterator, array and Range Access' for C++17 llvm-svn: 290976
* Fix __wrap_iter in debug mode and apply _NOEXCEPT_DEBUG to itEric Fiselier2016-12-281-46/+72
| | | | llvm-svn: 290654
* Fix unused parameters and variablesEric Fiselier2016-12-231-2/+2
| | | | llvm-svn: 290459
* Implement another part of P0031; adding constexpr to move_iteratorMarshall Clow2016-11-021-70/+76
| | | | llvm-svn: 285818
* Implement constexpr support for reverse_iterator. Reviewed as ↵Marshall Clow2016-10-191-59/+74
| | | | | | https://reviews.llvm.org/D25534 llvm-svn: 284602
* Mark ostream_iterator's constructors as noexcept.Marshall Clow2016-10-121-2/+2
| | | | llvm-svn: 284021
* [libc++] Remove various C++03 feature test macrosEric Fiselier2016-09-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`. This patch removes the __config macros: * _LIBCPP_HAS_NO_TRAILING_RETURN * _LIBCPP_HAS_NO_TEMPLATE_ALIASES * _LIBCPP_HAS_NO_ADVANCED_SFINAE * _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS * _LIBCPP_HAS_NO_STATIC_ASSERT As a drive I also changed our C++03 static_assert to use _Static_assert if available. I plan to commit this without review if nobody voices an objection. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24895 llvm-svn: 282347
* std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.Marshall Clow2016-08-101-8/+8
| | | | llvm-svn: 278282
* Change a couple ifdefs from '#if __cplusplus >= 2011xxx' to '#ifndef ↵Marshall Clow2016-07-181-5/+5
| | | | | | _LIBCPP_CXX03_LANG'. No functionality change. llvm-svn: 275787
* Implement LWG685 (which is from C++11!). Fixes PR#28421. Note: this ↵Marshall Clow2016-07-081-2/+123
| | | | | | (subtly) changes the return type of operator-(Iter1, Iter2) where Iter1 is a reverse iterator or a move_iterator, and Iter2 is some other move/reverse iterator type. In practice, I believe that almost every time the second param will be const_XXX and this will mean that the return type will be the same as it was before. llvm-svn: 274880
* Fix ::reference typedef in insert iterators.Eric Fiselier2016-06-301-6/+6
| | | | | | | | | | | | Since at least the C++11 standard insert iterators are specified as having ::reference typedef void. Libc++ was not doing that. This patch corrects the typedef. This patch changes the std::iterator base class of insert_iterator, front_insert_iterator and back_insert_iterator. This should not be an ABI breaking change. llvm-svn: 274209
* Implement LWG2576: istream_iterator and ostream_iterator should use ↵Marshall Clow2016-05-171-4/+4
| | | | | | std::addressof llvm-svn: 269789
* Fix LWG issue #2106: move_iterators returning prvaluesEric Fiselier2016-04-221-1/+6
| | | | llvm-svn: 267091
* Implement LWG#680, which was missed lo these many moons ago, and was ↵Marshall Clow2016-04-111-6/+3
| | | | | | reported as bug #27259. As a drive-by fix, replace the hand-rolled equivalent to addressof in __wrap_iter with the real thing. llvm-svn: 265914
* Make __wrap_iter work with GCC againEric Fiselier2016-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This bug was originally fixed in http://reviews.llvm.org/D7201. However it was broken again by the fix to https://llvm.org/bugs/show_bug.cgi?id=22605. This patch re-fixes __wrap_iter with GCC by providing a forward declaration of <vector> before the friend declaration in __wrap_iter. This patch avoids the issues in PR22605 by putting canonical forward declarations in <iosfwd> and including <iosfwd> in <vector>. <iosfwd> was chosen as the canonical forward declaration headers for the following reasons: 1. `<iosfwd>` is small with almost no dependancies. 2. It already forward declares `std::allocator` 3. It is already included in `<iterator>` which we need to fix the GCC bug. This patch fixes the test "gcc_workaround.pass.cpp" Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16345 llvm-svn: 261382
* Fix PR#25973 : 'basic_string::assign(InputIt, InputIt) doesn't provide the ↵Marshall Clow2016-01-131-0/+23
| | | | | | strong exception safety guarantee'. This turned out to be a pervasive problem in <string>, which required a fair amount of rework. Add in an optimization for when iterators provide noexcept increment/comparison/assignment/dereference (which covers many of the iterators in libc++). Reviewed as http://reviews.llvm.org/D15862 llvm-svn: 257682
* Implement LWG#2353: std::next is over-constrainedMarshall Clow2015-11-071-5/+5
| | | | llvm-svn: 252407
* A few bits of N2994 didn't get fully implemented a long time ago. Thanks to ↵Marshall Clow2015-04-161-2/+2
| | | | | | STL@microsoft.com for the bug report llvm-svn: 235134
* Rework reverse_iterator::operator[] so as not to use the base iterators ↵Marshall Clow2015-03-051-1/+1
| | | | | | operator [], which can cause constness problems. Fixes PR17883 llvm-svn: 231375
OpenPOWER on IntegriCloud