| 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 | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 |
| 10 | |
| 11 | #include <concepts> |
| 12 | #include <deque> |
| 13 | #include <flat_set> |
| 14 | #include <functional> |
| 15 | #include <ranges> |
| 16 | #include <string> |
| 17 | #include <vector> |
| 18 | #include "MinSequenceContainer.h" |
| 19 | #include "min_allocator.h" |
| 20 | |
| 21 | template <class KeyContainer> |
| 22 | void test() { |
| 23 | { |
| 24 | using Key = typename KeyContainer::value_type; |
| 25 | using C = std::flat_multiset<Key, std::less<Key>, KeyContainer>; |
| 26 | |
| 27 | static_assert(std::same_as<std::ranges::iterator_t<C>, typename C::iterator>); |
| 28 | static_assert(std::ranges::random_access_range<C>); |
| 29 | static_assert(std::ranges::common_range<C>); |
| 30 | static_assert(std::ranges::input_range<C>); |
| 31 | static_assert(!std::ranges::view<C>); |
| 32 | static_assert(std::ranges::sized_range<C>); |
| 33 | static_assert(!std::ranges::borrowed_range<C>); |
| 34 | static_assert(std::ranges::viewable_range<C>); |
| 35 | |
| 36 | static_assert(std::same_as<std::ranges::iterator_t<const C>, typename C::const_iterator>); |
| 37 | static_assert(std::ranges::random_access_range<const C>); |
| 38 | static_assert(std::ranges::common_range<const C>); |
| 39 | static_assert(std::ranges::input_range<const C>); |
| 40 | static_assert(!std::ranges::view<const C>); |
| 41 | static_assert(std::ranges::sized_range<const C>); |
| 42 | static_assert(!std::ranges::borrowed_range<const C>); |
| 43 | static_assert(!std::ranges::viewable_range<const C>); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | void test() { |
| 48 | test<std::vector<int>>(); |
| 49 | test<std::deque<int>>(); |
| 50 | test<MinSequenceContainer<int>>(); |
| 51 | test<std::vector<int, min_allocator<int>>>(); |
| 52 | } |
| 53 | |