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

source code of libcxx/test/std/containers/container.adaptors/flat.multimap/flat.multimap.iterators/range_concept_conformance.compile.pass.cpp