brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 4f4257f Raw
50 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710 11// constexpr drop_view(V base, range_difference_t<V> count);  // explicit since C++2312 13#include <ranges>14 15#include "test_convertible.h"16#include "test_macros.h"17#include "types.h"18 19// SFINAE tests.20 21#if TEST_STD_VER >= 2322 23static_assert(!test_convertible<std::ranges::drop_view<View>, View, std::ranges::range_difference_t<View>>(),24              "This constructor must be explicit");25 26#else27 28static_assert(test_convertible<std::ranges::drop_view<View>, View, std::ranges::range_difference_t<View>>(),29              "This constructor must not be explicit");30 31#endif // TEST_STD_VER >= 2332 33constexpr bool test() {34  std::ranges::drop_view dropView1(MoveOnlyView(), 4);35  assert(dropView1.size() == 4);36  assert(dropView1.begin() == globalBuff + 4);37 38  std::ranges::drop_view dropView2(ForwardView(), 4);39  assert(base(dropView2.begin()) == globalBuff + 4);40 41  return true;42}43 44int main(int, char**) {45  test();46  static_assert(test());47 48  return 0;49}50