Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / iterators / predef.iterators / reverse.iterators / reverse.iter.nav / postincrement.pass.cpp
blobf1d3ea21a5b860da95d24318fbc643e6c385f121
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <iterator>
11 // reverse_iterator
13 // reverse_iterator operator++(int); // constexpr in C++17
15 #include <iterator>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "test_iterators.h"
21 template <class It>
22 TEST_CONSTEXPR_CXX17 void test(It i, It x) {
23 std::reverse_iterator<It> r(i);
24 std::reverse_iterator<It> rr = r++;
25 assert(r.base() == x);
26 assert(rr.base() == i);
29 TEST_CONSTEXPR_CXX17 bool tests() {
30 const char* s = "123";
31 test(bidirectional_iterator<const char*>(s+1), bidirectional_iterator<const char*>(s));
32 test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s));
33 #if TEST_STD_VER >= 20
34 test(cpp20_random_access_iterator<const char*>(s + 1), cpp20_random_access_iterator<const char*>(s));
35 #endif
36 test(s+1, s);
37 return true;
40 int main(int, char**) {
41 tests();
42 #if TEST_STD_VER > 14
43 static_assert(tests(), "");
44 #endif
45 return 0;