xref: /freebsd/contrib/llvm-project/libcxx/include/flat_map (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric// -*- C++ -*-
2*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
3*700637cbSDimitry Andric//
4*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*700637cbSDimitry Andric//
8*700637cbSDimitry Andric//===----------------------------------------------------------------------===//
9*700637cbSDimitry Andric
10*700637cbSDimitry Andric#ifndef _LIBCPP_FLAT_MAP
11*700637cbSDimitry Andric#define _LIBCPP_FLAT_MAP
12*700637cbSDimitry Andric
13*700637cbSDimitry Andric/*
14*700637cbSDimitry Andric  Header <flat_map> synopsis
15*700637cbSDimitry Andric
16*700637cbSDimitry Andric#include <compare>              // see [compare.syn]
17*700637cbSDimitry Andric#include <initializer_list>     // see [initializer.list.syn]
18*700637cbSDimitry Andric
19*700637cbSDimitry Andricnamespace std {
20*700637cbSDimitry Andric  // [flat.map], class template flat_map
21*700637cbSDimitry Andric  template<class Key, class T, class Compare = less<Key>,
22*700637cbSDimitry Andric           class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
23*700637cbSDimitry Andric    class flat_map;
24*700637cbSDimitry Andric
25*700637cbSDimitry Andric  struct sorted_unique_t { explicit sorted_unique_t() = default; };
26*700637cbSDimitry Andric  inline constexpr sorted_unique_t sorted_unique{};
27*700637cbSDimitry Andric
28*700637cbSDimitry Andric  template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
29*700637cbSDimitry Andric           class Allocator>
30*700637cbSDimitry Andric    struct uses_allocator<flat_map<Key, T, Compare, KeyContainer, MappedContainer>,
31*700637cbSDimitry Andric                          Allocator>;
32*700637cbSDimitry Andric
33*700637cbSDimitry Andric  // [flat.map.erasure], erasure for flat_map
34*700637cbSDimitry Andric  template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
35*700637cbSDimitry Andric           class Predicate>
36*700637cbSDimitry Andric    typename flat_map<Key, T, Compare, KeyContainer, MappedContainer>::size_type
37*700637cbSDimitry Andric      erase_if(flat_map<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred);
38*700637cbSDimitry Andric
39*700637cbSDimitry Andric  // [flat.multimap], class template flat_multimap
40*700637cbSDimitry Andric  template<class Key, class T, class Compare = less<Key>,
41*700637cbSDimitry Andric           class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
42*700637cbSDimitry Andric    class flat_multimap;
43*700637cbSDimitry Andric
44*700637cbSDimitry Andric  struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; };
45*700637cbSDimitry Andric  inline constexpr sorted_equivalent_t sorted_equivalent{};
46*700637cbSDimitry Andric
47*700637cbSDimitry Andric  template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
48*700637cbSDimitry Andric           class Allocator>
49*700637cbSDimitry Andric    struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>,
50*700637cbSDimitry Andric                          Allocator>;
51*700637cbSDimitry Andric
52*700637cbSDimitry Andric  // [flat.multimap.erasure], erasure for flat_multimap
53*700637cbSDimitry Andric  template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
54*700637cbSDimitry Andric           class Predicate>
55*700637cbSDimitry Andric    typename flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>::size_type
56*700637cbSDimitry Andric      erase_if(flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred);
57*700637cbSDimitry Andric*/
58*700637cbSDimitry Andric
59*700637cbSDimitry Andric#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
60*700637cbSDimitry Andric#  include <__cxx03/__config>
61*700637cbSDimitry Andric#else
62*700637cbSDimitry Andric#  include <__config>
63*700637cbSDimitry Andric
64*700637cbSDimitry Andric#  if _LIBCPP_STD_VER >= 23
65*700637cbSDimitry Andric#    include <__flat_map/flat_map.h>
66*700637cbSDimitry Andric#    include <__flat_map/flat_multimap.h>
67*700637cbSDimitry Andric#    include <__flat_map/sorted_equivalent.h>
68*700637cbSDimitry Andric#    include <__flat_map/sorted_unique.h>
69*700637cbSDimitry Andric#  endif
70*700637cbSDimitry Andric
71*700637cbSDimitry Andric// for feature-test macros
72*700637cbSDimitry Andric#  include <version>
73*700637cbSDimitry Andric
74*700637cbSDimitry Andric// standard required includes
75*700637cbSDimitry Andric
76*700637cbSDimitry Andric// [iterator.range]
77*700637cbSDimitry Andric#  include <__iterator/access.h>
78*700637cbSDimitry Andric#  include <__iterator/data.h>
79*700637cbSDimitry Andric#  include <__iterator/empty.h>
80*700637cbSDimitry Andric#  include <__iterator/reverse_access.h>
81*700637cbSDimitry Andric#  include <__iterator/size.h>
82*700637cbSDimitry Andric
83*700637cbSDimitry Andric// [flat.map.syn]
84*700637cbSDimitry Andric#  include <compare>
85*700637cbSDimitry Andric#  include <initializer_list>
86*700637cbSDimitry Andric
87*700637cbSDimitry Andric#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
88*700637cbSDimitry Andric#    pragma GCC system_header
89*700637cbSDimitry Andric#  endif
90*700637cbSDimitry Andric#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
91*700637cbSDimitry Andric
92*700637cbSDimitry Andric#endif // _LIBCPP_FLAT_MAP
93