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//===----------------------------------------------------------------------===//
8
9// <iterator>
10
11// reverse_iterator
12
13// iterator_type base() const; // constexpr since C++17
14
15#include <iterator>
16#include <cassert>
17
18#include "test_macros.h"
19#include "test_iterators.h"
20
21TEST_CONSTEXPR_CXX17 bool test() {
22 typedef bidirectional_iterator<int*> Iter;
23 int i = 0;
24 Iter iter(&i);
25 std::reverse_iterator<Iter> const reverse(iter);
26 std::reverse_iterator<Iter>::iterator_type base = reverse.base();
27 assert(base == Iter(&i));
28 return true;
29}
30
31int main(int, char**) {
32 test();
33#if TEST_STD_VER > 14
34 static_assert(test(), "");
35#endif
36 return 0;
37}
38

source code of libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.conv/base.pass.cpp