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 // explicit reverse_iterator(Iter x); // constexpr since C++17 14 15 #include <iterator> 16 #include <cassert> 17 18 #include "test_macros.h" 19 #include "test_iterators.h" 20 21 template <class It> test(It i)22TEST_CONSTEXPR_CXX17 void test(It i) { 23 std::reverse_iterator<It> r(i); 24 assert(r.base() == i); 25 } 26 tests()27TEST_CONSTEXPR_CXX17 bool tests() { 28 const char s[] = "123"; 29 test(bidirectional_iterator<const char*>(s)); 30 test(random_access_iterator<const char*>(s)); 31 test(s); 32 return true; 33 } 34 main(int,char **)35int main(int, char**) { 36 tests(); 37 #if TEST_STD_VER > 14 38 static_assert(tests(), ""); 39 #endif 40 return 0; 41 } 42