Remove Activ libs and includes

This commit is contained in:
John Colvin committed 2023-12-15 13:15:08 -05:00
1 parent 28ed30c944
commit 4b718994be
10967 files changed
-2306716

No files matched your search

@@ -1,849 +0,0 @@
// Copyright (C) 2022 Joaquin M Lopez Munoz.
// Copyright (C) 2022 Christian Mazakas
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_DETAIL_FCA_HPP
#define ACTIV_BOOST_UNORDERED_DETAIL_FCA_HPP
/*
The general structure of the fast closed addressing implementation is that we
use straight-forward separate chaining (i.e. each bucket contains its own linked
list) and then improve iteration time by adding an array of "bucket groups".
A bucket group is a constant-width view into a subsection of the buckets array,
containing a bitmask that indicates which one of the buckets in the subsection
contains a list of nodes. This allows the code to test N buckets for occupancy
in a single operation. Additional speed can be found by inter-linking occupied
bucket groups with one another in a doubly-linked list. To this end, large
swathes of the bucket groups array no longer need to be iterated and have their
bitmasks examined for occupancy.
A bucket group iterator contains a pointer to a bucket group along with a
pointer into the buckets array. The iterator's bucket pointer is guaranteed to
point to a bucket within the bucket group's view of the array. To advance the
iterator, we need to determine if we need to skip to the next bucket group or
simply move to the next occupied bucket as denoted by the bitmask.
To accomplish this, we perform something roughly equivalent to this:
```
bucket_iterator itb = ...
bucket_pointer p = itb.p
bucket_group_pointer pbg = itb.pbg
offset = p - pbg->buckets
// because we wish to see if the _next_ bit in the mask is occupied, we'll
// generate a testing mask from the current offset + 1
//
testing_mask = reset_first_bits(offset + 1)
n = ctz(pbg->bitmask & testing_mask)
if (n < N) {
p = pbg->buckets + n
} else {
pbg = pbg->next
p = pbg->buckets + ctz(pbg->bitmask)
}
```
`reset_first_bits` yields an unsigned integral with the first n bits set to 0
and then by counting the number of trailing zeroes when AND'd against the bucket
group's bitmask, we can derive the offset into the buckets array. When the
calculated offset is equal to N, we know we've reached the end of a bucket group
and we can advance to the next one.
This is a rough explanation for how iterator incrementation should work for a
fixed width size of N as 3 for the bucket groups
```
N = 3
p = buckets
pbg->bitmask = 0b101
pbg->buckets = buckets
offset = p - pbg->buckets // => 0
testing_mask = reset_first_bits(offset + 1) // reset_first_bits(1) => 0b110
x = bitmask & testing_mask // => 0b101 & 0b110 => 0b100
ctz(x) // ctz(0b100) => 2
// 2 < 3
=> p = pbg->buckets + 2
// increment again...
offset = p - pbg->buckets // => 2
testing_mask = reset_first_bits(offset + 1) // reset_first_bits(3) => 0b000
bitmask & testing_mask // 0b101 & 0b000 => 0b000
ctz(0b000) => 3
// 3 < 3 is false now
pbg = pbg->next
initial_offset = ctz(pbg->bitmask)
p = pbg->buckets + initial_offset
```
For `size_` number of buckets, there are `1 + (size_ / N)` bucket groups where
`N` is the width of a bucket group, determined at compile-time.
We allocate space for `size_ + 1` buckets, using the last one as a dummy bucket
which is kept permanently empty so it can act as a sentinel value in the
implementation of `iterator end();`. We set the last bucket group to act as a
sentinel.
```
num_groups = size_ / N + 1
groups = allocate(num_groups)
pbg = groups + (num_groups - 1)
// not guaranteed to point to exactly N buckets
pbg->buckets = buckets + N * (size_ / N)
// this marks the true end of the bucket array
buckets pbg->bitmask = set_bit(size_ % N)
// links in on itself
pbg->next = pbg->prev = pbg
```
To this end, we can devise a safe iteration scheme while also creating a useful
sentinel to use as the end iterator.
Otherwise, usage of the data structure is relatively straight-forward compared
to normal separate chaining implementations.
*/
#include <ActivBoost/unordered/detail/prime_fmod.hpp>
#include <ActivBoost/core/addressof.hpp>
#include <ActivBoost/core/allocator_access.hpp>
#include <ActivBoost/core/bit.hpp>
#include <ActivBoost/core/empty_value.hpp>
#include <ActivBoost/core/no_exceptions_support.hpp>
#include <ActivBoost/cstdint.hpp>
#include <ActivBoost/move/core.hpp>
#include <ActivBoost/move/utility_core.hpp>
#include <ActivBoost/swap.hpp>
#include <ActivBoost/type_traits/aligned_storage.hpp>
#include <ActivBoost/type_traits/alignment_of.hpp>
#include <ActivBoost/config.hpp>
#include <iterator>
namespace Boost {
namespace unordered {
namespace detail {
template <class ValueType, class VoidPtr> struct node
{
typedef ValueType value_type;
typedef typename Boost::pointer_traits<VoidPtr>::template rebind_to<
node>::type node_pointer;
node_pointer next;
typename Boost::aligned_storage<sizeof(value_type),
Boost::alignment_of<value_type>::value>::type buf;
node() ACTIV_BOOST_NOEXCEPT : next(), buf() {}
value_type* value_ptr() ACTIV_BOOST_NOEXCEPT
{
return reinterpret_cast<value_type*>(buf.address());
}
value_type& value() ACTIV_BOOST_NOEXCEPT
{
return *reinterpret_cast<value_type*>(buf.address());
}
};
template <class Node, class VoidPtr> struct bucket
{
typedef typename Boost::pointer_traits<VoidPtr>::template rebind_to<
Node>::type node_pointer;
typedef typename Boost::pointer_traits<VoidPtr>::template rebind_to<
bucket>::type bucket_pointer;
node_pointer next;
bucket() ACTIV_BOOST_NOEXCEPT : next() {}
};
template <class Bucket> struct bucket_group
{
typedef typename Bucket::bucket_pointer bucket_pointer;
typedef
typename Boost::pointer_traits<bucket_pointer>::template rebind_to<
bucket_group>::type bucket_group_pointer;
ACTIV_BOOST_STATIC_CONSTANT(std::size_t, N = sizeof(std::size_t) * CHAR_BIT);
bucket_pointer buckets;
std::size_t bitmask;
bucket_group_pointer next, prev;
bucket_group() ACTIV_BOOST_NOEXCEPT : buckets(), bitmask(0), next(), prev() {}
~bucket_group() {}
};
inline std::size_t set_bit(std::size_t n) { return std::size_t(1) << n; }
inline std::size_t reset_bit(std::size_t n)
{
return ~(std::size_t(1) << n);
}
inline std::size_t reset_first_bits(std::size_t n) // n>0
{
return ~(~(std::size_t(0)) >> (sizeof(std::size_t) * 8 - n));
}
template <class Bucket> struct grouped_bucket_iterator
{
public:
typedef typename Bucket::bucket_pointer bucket_pointer;
typedef
typename Boost::pointer_traits<bucket_pointer>::template rebind_to<
bucket_group<Bucket> >::type bucket_group_pointer;
typedef Bucket value_type;
typedef typename Boost::pointer_traits<bucket_pointer>::difference_type
difference_type;
typedef Bucket& reference;
typedef Bucket* pointer;
typedef std::forward_iterator_tag iterator_category;
private:
bucket_pointer p;
bucket_group_pointer pbg;
public:
grouped_bucket_iterator() : p(), pbg() {}
reference operator*() const ACTIV_BOOST_NOEXCEPT { return dereference(); }
pointer operator->() const ACTIV_BOOST_NOEXCEPT
{
return Boost::to_address(p);
}
grouped_bucket_iterator& operator++() ACTIV_BOOST_NOEXCEPT
{
increment();
return *this;
}
grouped_bucket_iterator operator++(int) ACTIV_BOOST_NOEXCEPT
{
grouped_bucket_iterator old = *this;
increment();
return old;
}
bool operator==(
grouped_bucket_iterator const& other) const ACTIV_BOOST_NOEXCEPT
{
return equal(other);
}
bool operator!=(
grouped_bucket_iterator const& other) const ACTIV_BOOST_NOEXCEPT
{
return !equal(other);
}
private:
template <typename, typename, typename>
friend class grouped_bucket_array;
ACTIV_BOOST_STATIC_CONSTANT(std::size_t, N = bucket_group<Bucket>::N);
grouped_bucket_iterator(bucket_pointer p_, bucket_group_pointer pbg_)
: p(p_), pbg(pbg_)
{
}
Bucket& dereference() const ACTIV_BOOST_NOEXCEPT { return *p; }
bool equal(const grouped_bucket_iterator& x) const ACTIV_BOOST_NOEXCEPT
{
return p == x.p;
}
void increment() ACTIV_BOOST_NOEXCEPT
{
std::size_t const offset = static_cast<std::size_t>(p - pbg->buckets);
std::size_t n = std::size_t(Boost::core::countr_zero(
pbg->bitmask & reset_first_bits(offset + 1)));
if (n < N) {
p = pbg->buckets + static_cast<difference_type>(n);
} else {
pbg = pbg->next;
std::ptrdiff_t x = Boost::core::countr_zero(pbg->bitmask);
p = pbg->buckets + x;
}
}
};
template <class Node> struct const_grouped_local_bucket_iterator;
template <class Node> struct grouped_local_bucket_iterator
{
typedef typename Node::node_pointer node_pointer;
public:
typedef typename Node::value_type value_type;
typedef value_type element_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
grouped_local_bucket_iterator() : p() {}
reference operator*() const ACTIV_BOOST_NOEXCEPT { return dereference(); }
pointer operator->() const ACTIV_BOOST_NOEXCEPT
{
return Boost::to_address(p);
}
grouped_local_bucket_iterator& operator++() ACTIV_BOOST_NOEXCEPT
{
increment();
return *this;
}
grouped_local_bucket_iterator operator++(int) ACTIV_BOOST_NOEXCEPT
{
grouped_local_bucket_iterator old = *this;
increment();
return old;
}
bool operator==(
grouped_local_bucket_iterator const& other) const ACTIV_BOOST_NOEXCEPT
{
return equal(other);
}
bool operator!=(
grouped_local_bucket_iterator const& other) const ACTIV_BOOST_NOEXCEPT
{
return !equal(other);
}
private:
template <typename, typename, typename>
friend class grouped_bucket_array;
template <class> friend struct const_grouped_local_bucket_iterator;
grouped_local_bucket_iterator(node_pointer p_) : p(p_) {}
value_type& dereference() const ACTIV_BOOST_NOEXCEPT { return p->value(); }
bool equal(const grouped_local_bucket_iterator& x) const ACTIV_BOOST_NOEXCEPT
{
return p == x.p;
}
void increment() ACTIV_BOOST_NOEXCEPT { p = p->next; }
node_pointer p;
};
template <class Node> struct const_grouped_local_bucket_iterator
{
typedef typename Node::node_pointer node_pointer;
public:
typedef typename Node::value_type const value_type;
typedef value_type const element_type;
typedef value_type const* pointer;
typedef value_type const& reference;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
const_grouped_local_bucket_iterator() : p() {}
const_grouped_local_bucket_iterator(
grouped_local_bucket_iterator<Node> it)
: p(it.p)
{
}
reference operator*() const ACTIV_BOOST_NOEXCEPT { return dereference(); }
pointer operator->() const ACTIV_BOOST_NOEXCEPT
{
return Boost::to_address(p);
}
const_grouped_local_bucket_iterator& operator++() ACTIV_BOOST_NOEXCEPT
{
increment();
return *this;
}
const_grouped_local_bucket_iterator operator++(int) ACTIV_BOOST_NOEXCEPT
{
const_grouped_local_bucket_iterator old = *this;
increment();
return old;
}
bool operator==(
const_grouped_local_bucket_iterator const& other) const ACTIV_BOOST_NOEXCEPT
{
return equal(other);
}
bool operator!=(
const_grouped_local_bucket_iterator const& other) const ACTIV_BOOST_NOEXCEPT
{
return !equal(other);
}
private:
template <typename, typename, typename>
friend class grouped_bucket_array;
const_grouped_local_bucket_iterator(node_pointer p_) : p(p_) {}
value_type& dereference() const ACTIV_BOOST_NOEXCEPT { return p->value(); }
bool equal(
const const_grouped_local_bucket_iterator& x) const ACTIV_BOOST_NOEXCEPT
{
return p == x.p;
}
void increment() ACTIV_BOOST_NOEXCEPT { p = p->next; }
node_pointer p;
};
template <class T> struct span
{
T* begin() const ACTIV_BOOST_NOEXCEPT { return data; }
T* end() const ACTIV_BOOST_NOEXCEPT { return data + size; }
T* data;
std::size_t size;
span(T* data_, std::size_t size_) : data(data_), size(size_) {}
};
template <class Bucket, class Allocator, class SizePolicy>
class grouped_bucket_array
: Boost::empty_value<typename Boost::allocator_rebind<Allocator,
node<typename Boost::allocator_value_type<Allocator>::type,
typename Boost::allocator_void_pointer<Allocator>::type> >::
type>
{
ACTIV_BOOST_MOVABLE_BUT_NOT_COPYABLE(grouped_bucket_array)
typedef typename Boost::allocator_value_type<Allocator>::type
allocator_value_type;
typedef
typename Boost::allocator_void_pointer<Allocator>::type void_pointer;
typedef typename Boost::allocator_difference_type<Allocator>::type
difference_type;
public:
typedef typename Boost::allocator_rebind<Allocator,
node<allocator_value_type, void_pointer> >::type node_allocator_type;
typedef node<allocator_value_type, void_pointer> node_type;
typedef typename Boost::allocator_pointer<node_allocator_type>::type
node_pointer;
typedef SizePolicy size_policy;
private:
typedef typename Boost::allocator_rebind<Allocator, Bucket>::type
bucket_allocator_type;
typedef typename Boost::allocator_pointer<bucket_allocator_type>::type
bucket_pointer;
typedef Boost::pointer_traits<bucket_pointer> bucket_pointer_traits;
typedef bucket_group<Bucket> group;
typedef typename Boost::allocator_rebind<Allocator, group>::type
group_allocator_type;
typedef typename Boost::allocator_pointer<group_allocator_type>::type
group_pointer;
typedef typename Boost::pointer_traits<group_pointer>
group_pointer_traits;
public:
typedef Bucket value_type;
typedef Bucket bucket_type;
typedef std::size_t size_type;
typedef Allocator allocator_type;
typedef grouped_bucket_iterator<Bucket> iterator;
typedef grouped_local_bucket_iterator<node_type> local_iterator;
typedef const_grouped_local_bucket_iterator<node_type>
const_local_iterator;
private:
std::size_t size_index_, size_;
bucket_pointer buckets;
group_pointer groups;
public:
static std::size_t bucket_count_for(std::size_t num_buckets)
{
if (num_buckets == 0) {
return 0;
}
return size_policy::size(size_policy::size_index(num_buckets));
}
grouped_bucket_array()
: empty_value<node_allocator_type>(
empty_init_t(), node_allocator_type()),
size_index_(0), size_(0), buckets(), groups()
{
}
grouped_bucket_array(size_type n, const Allocator& al)
: empty_value<node_allocator_type>(empty_init_t(), al),
size_index_(0),
size_(0), buckets(), groups()
{
if (n == 0) {
return;
}
size_index_ = size_policy::size_index(n);
size_ = size_policy::size(size_index_);
bucket_allocator_type bucket_alloc = this->get_bucket_allocator();
group_allocator_type group_alloc = this->get_group_allocator();
size_type const num_buckets = buckets_len();
size_type const num_groups = groups_len();
buckets = Boost::allocator_allocate(bucket_alloc, num_buckets);
ACTIV_BOOST_TRY
{
groups = Boost::allocator_allocate(group_alloc, num_groups);
bucket_type* pb = Boost::to_address(buckets);
for (size_type i = 0; i < num_buckets; ++i) {
new (pb + i) bucket_type();
}
group* pg = Boost::to_address(groups);
for (size_type i = 0; i < num_groups; ++i) {
new (pg + i) group();
}
}
ACTIV_BOOST_CATCH(...)
{
Boost::allocator_deallocate(bucket_alloc, buckets, num_buckets);
ACTIV_BOOST_RETHROW
}
ACTIV_BOOST_CATCH_END
size_type const N = group::N;
group_pointer pbg =
groups + static_cast<difference_type>(num_groups - 1);
pbg->buckets =
buckets + static_cast<difference_type>(N * (size_ / N));
pbg->bitmask = set_bit(size_ % N);
pbg->next = pbg->prev = pbg;
}
~grouped_bucket_array() { this->deallocate(); }
grouped_bucket_array(
ACTIV_BOOST_RV_REF(grouped_bucket_array) other) ACTIV_BOOST_NOEXCEPT
: empty_value<node_allocator_type>(
empty_init_t(), other.get_node_allocator()),
size_index_(other.size_index_),
size_(other.size_),
buckets(other.buckets),
groups(other.groups)
{
other.size_ = 0;
other.size_index_ = 0;
other.buckets = bucket_pointer();
other.groups = group_pointer();
}
grouped_bucket_array& operator=(
ACTIV_BOOST_RV_REF(grouped_bucket_array) other) ACTIV_BOOST_NOEXCEPT
{
ACTIV_BOOST_ASSERT(
this->get_node_allocator() == other.get_node_allocator());
if (this == Boost::addressof(other)) {
return *this;
}
this->deallocate();
size_index_ = other.size_index_;
size_ = other.size_;
buckets = other.buckets;
groups = other.groups;
other.size_index_ = 0;
other.size_ = 0;
other.buckets = bucket_pointer();
other.groups = group_pointer();
return *this;
}
void deallocate() ACTIV_BOOST_NOEXCEPT
{
if (buckets) {
bucket_allocator_type bucket_alloc = this->get_bucket_allocator();
Boost::allocator_deallocate(
bucket_alloc, buckets, this->buckets_len());
buckets = bucket_pointer();
}
if (groups) {
group_allocator_type group_alloc = this->get_group_allocator();
Boost::allocator_deallocate(
group_alloc, groups, this->groups_len());
groups = group_pointer();
}
}
void swap(grouped_bucket_array& other)
{
std::swap(size_index_, other.size_index_);
std::swap(size_, other.size_);
std::swap(buckets, other.buckets);
std::swap(groups, other.groups);
bool b = Boost::allocator_propagate_on_container_swap<
allocator_type>::type::value;
if (b) {
Boost::swap(get_node_allocator(), other.get_node_allocator());
}
}
node_allocator_type const& get_node_allocator() const
{
return empty_value<node_allocator_type>::get();
}
node_allocator_type& get_node_allocator()
{
return empty_value<node_allocator_type>::get();
}
bucket_allocator_type get_bucket_allocator() const
{
return this->get_node_allocator();
}
group_allocator_type get_group_allocator() const
{
return this->get_node_allocator();
}
size_type buckets_len() const ACTIV_BOOST_NOEXCEPT { return size_ + 1; }
size_type groups_len() const ACTIV_BOOST_NOEXCEPT
{
return size_ / group::N + 1;
}
void reset_allocator(Allocator const& allocator_)
{
this->get_node_allocator() = node_allocator_type(allocator_);
}
size_type bucket_count() const { return size_; }
iterator begin() const { return size_ == 0 ? end() : ++at(size_); }
iterator end() const
{
// micro optimization: no need to return the bucket group
// as end() is not incrementable
iterator pbg;
pbg.p =
buckets + static_cast<difference_type>(this->buckets_len() - 1);
return pbg;
}
local_iterator begin(size_type n) const
{
if (size_ == 0) {
return this->end(n);
}
return local_iterator(
(buckets + static_cast<difference_type>(n))->next);
}
local_iterator end(size_type) const { return local_iterator(); }
size_type capacity() const ACTIV_BOOST_NOEXCEPT { return size_; }
iterator at(size_type n) const
{
if (size_ > 0) {
std::size_t const N = group::N;
iterator pbg(buckets + static_cast<difference_type>(n),
groups + static_cast<difference_type>(n / N));
return pbg;
} else {
return this->end();
}
}
span<Bucket> raw()
{
ACTIV_BOOST_ASSERT(size_ == 0 || size_ < this->buckets_len());
return span<Bucket>(Boost::to_address(buckets), size_);
}
size_type position(std::size_t hash) const
{
return size_policy::position(hash, size_index_);
}
void clear()
{
this->deallocate();
size_index_ = 0;
size_ = 0;
}
void append_bucket_group(iterator itb) ACTIV_BOOST_NOEXCEPT
{
std::size_t const N = group::N;
bool const is_empty_bucket = (!itb->next);
if (is_empty_bucket) {
bucket_pointer pb = itb.p;
group_pointer pbg = itb.pbg;
std::size_t n =
static_cast<std::size_t>(Boost::to_address(pb) - &buckets[0]);
bool const is_empty_group = (!pbg->bitmask);
if (is_empty_group) {
size_type const num_groups = this->groups_len();
group_pointer last_group =
groups + static_cast<difference_type>(num_groups - 1);
pbg->buckets =
buckets + static_cast<difference_type>(N * (n / N));
pbg->next = last_group->next;
pbg->next->prev = pbg;
pbg->prev = last_group;
pbg->prev->next = pbg;
}
pbg->bitmask |= set_bit(n % N);
}
}
void insert_node(iterator itb, node_pointer p) ACTIV_BOOST_NOEXCEPT
{
this->append_bucket_group(itb);
p->next = itb->next;
itb->next = p;
}
void insert_node_hint(
iterator itb, node_pointer p, node_pointer hint) ACTIV_BOOST_NOEXCEPT
{
this->append_bucket_group(itb);
if (hint) {
p->next = hint->next;
hint->next = p;
} else {
p->next = itb->next;
itb->next = p;
}
}
void extract_node(iterator itb, node_pointer p) ACTIV_BOOST_NOEXCEPT
{
node_pointer* pp = Boost::addressof(itb->next);
while ((*pp) != p)
pp = Boost::addressof((*pp)->next);
*pp = p->next;
if (!itb->next)
unlink_bucket(itb);
}
void extract_node_after(iterator itb, node_pointer* pp) ACTIV_BOOST_NOEXCEPT
{
*pp = (*pp)->next;
if (!itb->next)
unlink_bucket(itb);
}
void unlink_empty_buckets() ACTIV_BOOST_NOEXCEPT
{
std::size_t const N = group::N;
group_pointer pbg = groups,
last = groups + static_cast<difference_type>(
this->groups_len() - 1);
for (; pbg != last; ++pbg) {
if (!pbg->buckets) {
continue;
}
for (std::size_t n = 0; n < N; ++n) {
bucket_pointer bs = pbg->buckets;
bucket_type& b = bs[static_cast<std::ptrdiff_t>(n)];
if (!b.next)
pbg->bitmask &= reset_bit(n);
}
if (!pbg->bitmask && pbg->next)
unlink_group(pbg);
}
// do not check end bucket
for (std::size_t n = 0; n < size_ % N; ++n) {
if (!pbg->buckets[static_cast<std::ptrdiff_t>(n)].next)
pbg->bitmask &= reset_bit(n);
}
}
void unlink_bucket(iterator itb)
{
typename iterator::bucket_pointer p = itb.p;
typename iterator::bucket_group_pointer pbg = itb.pbg;
if (!(pbg->bitmask &=
reset_bit(static_cast<std::size_t>(p - pbg->buckets))))
unlink_group(pbg);
}
private:
void unlink_group(group_pointer pbg)
{
pbg->next->prev = pbg->prev;
pbg->prev->next = pbg->next;
pbg->prev = pbg->next = group_pointer();
}
};
} // namespace detail
} // namespace unordered
} // namespace Boost
#endif // ACTIV_BOOST_UNORDERED_DETAIL_FCA_HPP
File diff suppressed because it is too large. Load diff
@@ -1,64 +0,0 @@
// Copyright (C) 2008-2016 Daniel James.
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_FWD_HPP_INCLUDED
#define ACTIV_BOOST_UNORDERED_FWD_HPP_INCLUDED
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/predef.h>
#if defined(ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT)
// Already defined.
#elif defined(ACTIV_BOOST_LIBSTDCXX11)
// https://github.com/gcc-mirror/gcc/blob/gcc-4_6-branch/libstdc++-v3/include/bits/stl_pair.h#L70
#if ACTIV_BOOST_LIBSTDCXX_VERSION > 40600
#define ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1
#endif
#elif ACTIV_BOOST_LIB_STD_CXX
// https://github.com/llvm-mirror/libcxx/blob/release_30/include/utility#L206
#if ACTIV_BOOST_LIB_STD_CXX >= ACTIV_BOOST_VERSION_NUMBER(3, 0, 0)
#define ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1
#endif
#elif defined(ACTIV_BOOST_LIB_STD_DINKUMWARE)
// Apparently C++11 standard supported in Visual Studio 2012
// https://msdn.microsoft.com/en-us/library/hh567368.aspx#stl
// 2012 = VC+11 = ACTIV_BOOST_MSVC 1700 Hopefully!
// I have no idea when Dinkumware added it, probably a lot
// earlier than this check.
#if ACTIV_BOOST_LIB_STD_DINKUMWARE >= ACTIV_BOOST_VERSION_NUMBER(6, 10, 0) || \
ACTIV_BOOST_COMP_MSVC >= ACTIV_BOOST_VERSION_NUMBER(17, 0, 0)
#define ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1
#endif
#endif
// Assume that an unknown library does not support piecewise construction.
#if !defined(ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT)
#define ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 0
#endif
#if ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT
#include <utility>
#endif
namespace Boost {
namespace unordered {
#if ACTIV_BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT
using std::piecewise_construct_t;
using std::piecewise_construct;
#else
struct piecewise_construct_t
{
};
const piecewise_construct_t piecewise_construct = piecewise_construct_t();
#endif
}
}
#endif
File diff suppressed because it is too large. Load diff
@@ -1,61 +0,0 @@
// Copyright (C) 2005-2016 Daniel James
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <ActivBoost/unordered/detail/implementation.hpp>
#include <ActivBoost/unordered/unordered_map_fwd.hpp>
namespace Boost {
namespace unordered {
namespace detail {
template <typename A, typename K, typename M, typename H, typename P>
struct map
{
typedef Boost::unordered::detail::map<A, K, M, H, P> types;
typedef std::pair<K const, M> value_type;
typedef H hasher;
typedef P key_equal;
typedef K const const_key_type;
typedef
typename ::Boost::unordered::detail::rebind_wrap<A, value_type>::type
value_allocator;
typedef Boost::unordered::detail::allocator_traits<value_allocator>
value_allocator_traits;
typedef Boost::unordered::detail::table<types> table;
typedef Boost::unordered::detail::map_extractor<value_type> extractor;
typedef typename Boost::allocator_void_pointer<value_allocator>::type
void_pointer;
typedef Boost::unordered::node_handle_map<
node<value_type, void_pointer>, K, M, A>
node_type;
typedef typename table::iterator iterator;
typedef Boost::unordered::insert_return_type_map<iterator, node_type> insert_return_type;
};
template <typename K, typename M, typename H, typename P, typename A>
class instantiate_map
{
typedef Boost::unordered_map<K, M, H, P, A> container;
container x;
typename container::node_type node_type;
typename container::insert_return_type insert_return_type;
};
template <typename K, typename M, typename H, typename P, typename A>
class instantiate_multimap
{
typedef Boost::unordered_multimap<K, M, H, P, A> container;
container x;
typename container::node_type node_type;
};
}
}
}
@@ -1,268 +0,0 @@
// Copyright (C) 2022 Joaquin M Lopez Munoz.
// Copyright (C) 2022 Christian Mazakas
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_DETAIL_PRIME_FMOD_HPP
#define ACTIV_BOOST_UNORDERED_DETAIL_PRIME_FMOD_HPP
#include <ActivBoost/cstdint.hpp>
#include <ActivBoost/preprocessor/seq/enum.hpp>
#include <ActivBoost/preprocessor/seq/for_each.hpp>
#include <ActivBoost/preprocessor/seq/size.hpp>
#include <ActivBoost/config.hpp>
#include <climits>
#include <cstddef>
#if defined(SIZE_MAX)
#if ((((SIZE_MAX >> 16) >> 16) >> 16) >> 15) != 0
#define ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T
#endif
#elif defined(UINTPTR_MAX) /* used as proxy for std::size_t */
#if ((((UINTPTR_MAX >> 16) >> 16) >> 16) >> 15) != 0
#define ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T
#endif
#endif
#if defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) && defined(_MSC_VER)
#include <intrin.h>
#endif
namespace Boost {
namespace unordered {
namespace detail {
template <class = void> struct prime_fmod_size
{
// Because we compile for C++03, we don't have access to any inline
// initialization for array data members so the definitions must exist
// out-of-line. To keep the library header-only, we introduce a dummy
// template parameter which permits the definition to be included in
// multiple TUs without conflict.
//
static std::size_t sizes[];
static std::size_t const sizes_len;
static std::size_t (*positions[])(std::size_t);
#if defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
static Boost::uint64_t inv_sizes32[];
static std::size_t const inv_sizes32_len;
#endif /* defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) */
static inline std::size_t size_index(std::size_t n)
{
std::size_t i = 0;
for (; i < (sizes_len - 1); ++i) {
if (sizes[i] >= n) {
break;
}
}
return i;
}
static inline std::size_t size(std::size_t size_index)
{
return sizes[size_index];
}
template <std::size_t Size> static std::size_t modulo(std::size_t hash)
{
return hash % Size;
}
#if defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
// We emulate the techniques taken from:
// Faster Remainder by Direct Computation: Applications to Compilers and
// Software Libraries
// https://arxiv.org/abs/1902.01961
//
// In essence, use fancy math to directly calculate the remainder (aka
// modulo) exploiting how compilers transform division
//
static inline Boost::uint64_t get_remainder(
Boost::uint64_t fractional, Boost::uint32_t d)
{
#if defined(_MSC_VER)
// use MSVC intrinsics when available to avoid promotion to 128 bits
return __umulh(fractional, d);
#elif defined(ACTIV_BOOST_HAS_INT128)
return static_cast<Boost::uint64_t>(
((Boost::uint128_type)fractional * d) >> 64);
#else
// portable implementation in the absence of Boost::uint128_type on 64
// bits, which happens at least in GCC 4.5 and prior
Boost::uint64_t r1 = (fractional & UINT32_MAX) * d;
Boost::uint64_t r2 = (fractional >> 32) * d;
r2 += r1 >> 32;
return r2 >> 32;
#endif /* defined(_MSC_VER) */
}
static inline Boost::uint32_t fast_modulo(
Boost::uint32_t a, Boost::uint64_t M, Boost::uint32_t d)
{
Boost::uint64_t fractional = M * a;
return (Boost::uint32_t)(get_remainder(fractional, d));
}
#endif /* defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) */
static inline std::size_t position(
std::size_t hash, std::size_t size_index)
{
#if defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
std::size_t sizes_under_32bit = inv_sizes32_len;
if (ACTIV_BOOST_LIKELY(size_index < sizes_under_32bit)) {
#if defined(__MSVC_RUNTIME_CHECKS)
return fast_modulo(
Boost::uint32_t(hash & 0xffffffffu) + Boost::uint32_t(hash >> 32),
inv_sizes32[size_index], Boost::uint32_t(sizes[size_index]));
#else
return fast_modulo(
Boost::uint32_t(hash) + Boost::uint32_t(hash >> 32),
inv_sizes32[size_index], Boost::uint32_t(sizes[size_index]));
#endif
} else {
return positions[size_index - sizes_under_32bit](hash);
}
#else
return positions[size_index](hash);
#endif /* defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) */
}
}; // prime_fmod_size
#define ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT_INCOMPLETE \
(13ul)(29ul)(53ul)(97ul)(193ul)(389ul)(769ul)(1543ul)(3079ul)(6151ul)( \
12289ul)(24593ul)(49157ul)(98317ul)(196613ul)(393241ul)(786433ul)( \
1572869ul)(3145739ul)(6291469ul)(12582917ul)(25165843ul)(50331653ul)( \
100663319ul)(201326611ul)(402653189ul)(805306457ul)(1610612741ul)( \
3221225473ul)
#if !defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
#define ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT \
ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT_INCOMPLETE(4294967291ul)
#define ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_64BIT
#else
#define ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT \
ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT_INCOMPLETE
// The original sequence here is this:
// (6442450939ul)
// (12884901893ul)
// (25769803751ul)
// (51539607551ul)
// (103079215111ul)
// (206158430209ul)
// (412316860441ul)
// (824633720831ul)
// (1649267441651ul)
//
// but this causes problems on versions of mingw where the `long` type is 32
// bits, even for 64-bit targets. We work around this by replacing the literals
// with compile-time arithmetic, using bitshifts to reconstruct the number.
//
// clang-format off
#define ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_64BIT \
((Boost::ulong_long_type(1ul) << 32) + Boost::ulong_long_type(2147483643ul)) \
((Boost::ulong_long_type(3ul) << 32) + Boost::ulong_long_type(5ul)) \
((Boost::ulong_long_type(5ul) << 32) + Boost::ulong_long_type(4294967271ul)) \
((Boost::ulong_long_type(11ul) << 32) + Boost::ulong_long_type(4294967295ul)) \
((Boost::ulong_long_type(24ul) << 32) + Boost::ulong_long_type(7ul)) \
((Boost::ulong_long_type(48ul) << 32) + Boost::ulong_long_type(1ul)) \
((Boost::ulong_long_type(96ul) << 32) + Boost::ulong_long_type(25ul)) \
((Boost::ulong_long_type(191ul) << 32) + Boost::ulong_long_type(4294967295ul)) \
((Boost::ulong_long_type(383ul) << 32) + Boost::ulong_long_type(4294967283ul))
// clang-format on
#endif /* ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T */
#define ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES \
ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_64BIT
template <class T>
std::size_t prime_fmod_size<T>::sizes[] = {
ACTIV_BOOST_PP_SEQ_ENUM(ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES)};
template <class T>
std::size_t const prime_fmod_size<T>::sizes_len = ACTIV_BOOST_PP_SEQ_SIZE(
ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES);
// Similarly here, we have to re-express the integer initialization using
// arithmetic such that each literal can fit in a 32-bit value.
//
#if defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
// clang-format off
template <class T>
Boost::uint64_t prime_fmod_size<T>::inv_sizes32[] = {
(Boost::ulong_long_type(330382099ul) << 32) + Boost::ulong_long_type(2973438898ul) /* = 1418980313362273202 */,
(Boost::ulong_long_type(148102320ul) << 32) + Boost::ulong_long_type(2369637129ul) /* = 636094623231363849 */,
(Boost::ulong_long_type(81037118ul) << 32) + Boost::ulong_long_type(3403558990ul) /* = 348051774975651918 */,
(Boost::ulong_long_type(44278013ul) << 32) + Boost::ulong_long_type(1549730468ul) /* = 190172619316593316 */,
(Boost::ulong_long_type(22253716ul) << 32) + Boost::ulong_long_type(2403401389ul) /* = 95578984837873325 */,
(Boost::ulong_long_type(11041047ul) << 32) + Boost::ulong_long_type(143533612ul) /* = 47420935922132524 */,
(Boost::ulong_long_type(5585133ul) << 32) + Boost::ulong_long_type(106117528ul) /* = 23987963684927896 */,
(Boost::ulong_long_type(2783517ul) << 32) + Boost::ulong_long_type(1572687312ul) /* = 11955116055547344 */,
(Boost::ulong_long_type(1394922ul) << 32) + Boost::ulong_long_type(3428720239ul) /* = 5991147799191151 */,
(Boost::ulong_long_type(698255ul) << 32) + Boost::ulong_long_type(552319807ul) /* = 2998982941588287 */,
(Boost::ulong_long_type(349496ul) << 32) + Boost::ulong_long_type(3827689953ul) /* = 1501077717772769 */,
(Boost::ulong_long_type(174641ul) << 32) + Boost::ulong_long_type(3699438549ul) /* = 750081082979285 */,
(Boost::ulong_long_type(87372ul) << 32) + Boost::ulong_long_type(1912757574ul) /* = 375261795343686 */,
(Boost::ulong_long_type(43684ul) << 32) + Boost::ulong_long_type(3821029929ul) /* = 187625172388393 */,
(Boost::ulong_long_type(21844ul) << 32) + Boost::ulong_long_type(3340590800ul) /* = 93822606204624 */,
(Boost::ulong_long_type(10921ul) << 32) + Boost::ulong_long_type(4175852267ul) /* = 46909513691883 */,
(Boost::ulong_long_type(5461ul) << 32) + Boost::ulong_long_type(1401829642ul) /* = 23456218233098 */,
(Boost::ulong_long_type(2730ul) << 32) + Boost::ulong_long_type(2826028947ul) /* = 11728086747027 */,
(Boost::ulong_long_type(1365ul) << 32) + Boost::ulong_long_type(1411150351ul) /* = 5864041509391 */,
(Boost::ulong_long_type(682ul) << 32) + Boost::ulong_long_type(2857253105ul) /* = 2932024948977 */,
(Boost::ulong_long_type(341ul) << 32) + Boost::ulong_long_type(1431073224ul) /* = 1466014921160 */,
(Boost::ulong_long_type(170ul) << 32) + Boost::ulong_long_type(2862758116ul) /* = 733007198436 */,
(Boost::ulong_long_type(85ul) << 32) + Boost::ulong_long_type(1431619357ul) /* = 366503839517 */,
(Boost::ulong_long_type(42ul) << 32) + Boost::ulong_long_type(2863269661ul) /* = 183251896093 */,
(Boost::ulong_long_type(21ul) << 32) + Boost::ulong_long_type(1431647119ul) /* = 91625960335 */,
(Boost::ulong_long_type(10ul) << 32) + Boost::ulong_long_type(2863310962ul) /* = 45812983922 */,
(Boost::ulong_long_type(5ul) << 32) + Boost::ulong_long_type(1431653234ul) /* = 22906489714 */,
(Boost::ulong_long_type(2ul) << 32) + Boost::ulong_long_type(2863311496ul) /* = 11453246088 */,
(Boost::ulong_long_type(1ul) << 32) + Boost::ulong_long_type(1431655764ul) /* = 5726623060 */,
};
// clang-format on
template <class T>
std::size_t const
prime_fmod_size<T>::inv_sizes32_len = sizeof(inv_sizes32) /
sizeof(inv_sizes32[0]);
#endif /* defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T) */
#define ACTIV_BOOST_UNORDERED_PRIME_FMOD_POSITIONS_ELEMENT(z, _, n) \
prime_fmod_size<T>::template modulo<n>,
template <class T>
std::size_t (*prime_fmod_size<T>::positions[])(std::size_t) = {
#if !defined(ACTIV_BOOST_UNORDERED_FCA_HAS_64B_SIZE_T)
ACTIV_BOOST_PP_SEQ_FOR_EACH(ACTIV_BOOST_UNORDERED_PRIME_FMOD_POSITIONS_ELEMENT, ~,
ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT)
#else
ACTIV_BOOST_PP_SEQ_FOR_EACH(ACTIV_BOOST_UNORDERED_PRIME_FMOD_POSITIONS_ELEMENT, ~,
ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_64BIT)
#endif
};
#undef ACTIV_BOOST_UNORDERED_PRIME_FMOD_POSITIONS_ELEMENT
#undef ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES
#undef ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_64BIT
#undef ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT
#undef ACTIV_BOOST_UNORDERED_PRIME_FMOD_SIZES_32BIT_INCOMPLETE
} // namespace detail
} // namespace unordered
} // namespace Boost
#endif // ACTIV_BOOST_UNORDERED_DETAIL_PRIME_FMOD_HPP
@@ -1,61 +0,0 @@
// Copyright (C) 2005-2016 Daniel James
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <ActivBoost/unordered/detail/implementation.hpp>
#include <ActivBoost/unordered/unordered_set_fwd.hpp>
namespace Boost {
namespace unordered {
namespace detail {
template <typename A, typename T, typename H, typename P> struct set
{
typedef Boost::unordered::detail::set<A, T, H, P> types;
typedef T value_type;
typedef H hasher;
typedef P key_equal;
typedef T const const_key_type;
typedef
typename ::Boost::unordered::detail::rebind_wrap<A, value_type>::type
value_allocator;
typedef Boost::unordered::detail::allocator_traits<value_allocator>
value_allocator_traits;
typedef Boost::unordered::detail::table<types> table;
typedef Boost::unordered::detail::set_extractor<value_type> extractor;
typedef typename Boost::allocator_void_pointer<value_allocator>::type
void_pointer;
typedef Boost::unordered::node_handle_set<
node<value_type, void_pointer>, T, A>
node_type;
typedef typename table::c_iterator iterator;
typedef Boost::unordered::insert_return_type_set<iterator, node_type>
insert_return_type;
};
template <typename T, typename H, typename P, typename A>
class instantiate_set
{
typedef Boost::unordered_set<T, H, P, A> container;
container x;
typename container::node_type node_type;
typename container::insert_return_type insert_return_type;
};
template <typename T, typename H, typename P, typename A>
class instantiate_multiset
{
typedef Boost::unordered_multiset<T, H, P, A> container;
container x;
typename container::node_type node_type;
};
}
}
}
@@ -1,109 +0,0 @@
// Copyright (C) 2022 Christian Mazakas
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_DETAIL_TYPE_TRAITS_HPP
#define ACTIV_BOOST_UNORDERED_DETAIL_TYPE_TRAITS_HPP
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/type_traits/integral_constant.hpp>
#include <ActivBoost/type_traits/is_convertible.hpp>
#include <ActivBoost/type_traits/make_void.hpp>
#include <ActivBoost/type_traits/type_identity.hpp>
#if !defined(ACTIV_BOOST_NO_CXX17_DEDUCTION_GUIDES)
#include <ActivBoost/type_traits/enable_if.hpp>
#include <ActivBoost/type_traits/is_integral.hpp>
#include <ActivBoost/type_traits/remove_const.hpp>
#endif
// ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
#if !defined(ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES)
#if !defined(ACTIV_BOOST_NO_CXX17_DEDUCTION_GUIDES)
#define ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 1
#endif
#endif
#if !defined(ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES)
#define ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 0
#endif
namespace Boost {
namespace unordered {
namespace detail {
////////////////////////////////////////////////////////////////////////////
// Type checkers used for the transparent member functions added by C++20
// and up
template <class, class = void>
struct is_transparent : public Boost::false_type
{
};
template <class T>
struct is_transparent<T,
typename Boost::make_void<typename T::is_transparent>::type>
: public Boost::true_type
{
};
template <class, class A, class B> struct are_transparent
{
static bool const value =
is_transparent<A>::value && is_transparent<B>::value;
};
template <class Key, class UnorderedMap> struct transparent_non_iterable
{
typedef typename UnorderedMap::hasher hash;
typedef typename UnorderedMap::key_equal key_equal;
typedef typename UnorderedMap::iterator iterator;
typedef typename UnorderedMap::const_iterator const_iterator;
static bool const value =
are_transparent<Key, hash, key_equal>::value &&
!Boost::is_convertible<Key, iterator>::value &&
!Boost::is_convertible<Key, const_iterator>::value;
};
#if ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
// https://eel.is/c++draft/container.requirements#container.alloc.reqmts-34
// https://eel.is/c++draft/container.requirements#unord.req.general-243
template <class InputIterator>
constexpr bool const is_input_iterator_v =
!Boost::is_integral<InputIterator>::value;
template <class A, class = void> struct is_allocator
{
constexpr static bool const value = false;
};
template <class A>
struct is_allocator<A,
Boost::void_t<typename A::value_type,
decltype(std::declval<A&>().allocate(std::size_t{}))> >
{
constexpr static bool const value = true;
};
template <class A>
constexpr bool const is_allocator_v = is_allocator<A>::value;
template <class H>
constexpr bool const is_hash_v =
!Boost::is_integral<H>::value && !is_allocator_v<H>;
template <class P> constexpr bool const is_pred_v = !is_allocator_v<P>;
#endif
} // namespace detail
} // namespace unordered
} // namespace Boost
#endif // ACTIV_BOOST_UNORDERED_DETAIL_TYPE_TRAITS_HPP
@@ -1,75 +0,0 @@
/* 32b/64b xmx mix function.
*
* Copyright 2022 Peter Dimov.
* Copyright 2022 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See https://www.boost.org/libs/unordered for library home page.
*/
#ifndef ACTIV_BOOST_UNORDERED_DETAIL_XMX_HPP
#define ACTIV_BOOST_UNORDERED_DETAIL_XMX_HPP
#include <ActivBoost/cstdint.hpp>
#include <climits>
#include <cstddef>
namespace Boost{
namespace unordered{
namespace detail{
/* Bit mixer for improvement of statistical properties of hash functions.
* The implementation is different on 64bit and 32bit architectures:
*
* - 64bit: same as xmx function in
* http://jonkagstrom.com/bit-mixer-construction/index.html
* - 32bit: generated by Hash Function Prospector
* (https://github.com/skeeto/hash-prospector) and selected as the
* best overall performer in benchmarks of Boost.Unordered flat containers.
* Score assigned by Hash Prospector: 333.7934929677524
*/
#if defined(SIZE_MAX)
#if ((((SIZE_MAX >> 16) >> 16) >> 16) >> 15) != 0
#define ACTIV_BOOST_UNORDERED_64B_ARCHITECTURE /* >64 bits assumed as 64 bits */
#endif
#elif defined(UINTPTR_MAX) /* used as proxy for std::size_t */
#if ((((UINTPTR_MAX >> 16) >> 16) >> 16) >> 15) != 0
#define ACTIV_BOOST_UNORDERED_64B_ARCHITECTURE
#endif
#endif
static inline std::size_t xmx(std::size_t x)noexcept
{
#if defined(ACTIV_BOOST_UNORDERED_64B_ARCHITECTURE)
Boost::uint64_t z=(Boost::uint64_t)x;
z^=z>>23;
z*=0xff51afd7ed558ccdull;
z^=z>>23;
return (std::size_t)z;
#else /* 32 bits assumed */
x^=x>>18;
x*=0x56b5aaadu;
x^=x>>16;
return x;
#endif
}
#ifdef ACTIV_BOOST_UNORDERED_64B_ARCHITECTURE
#undef ACTIV_BOOST_UNORDERED_64B_ARCHITECTURE
#endif
} /* namespace detail */
} /* namespace unordered */
} /* namespace Boost */
#endif
@@ -1,45 +0,0 @@
/* Hash function characterization.
*
* Copyright 2022 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See https://www.boost.org/libs/unordered for library home page.
*/
#ifndef ACTIV_BOOST_UNORDERED_HASH_TRAITS_HPP
#define ACTIV_BOOST_UNORDERED_HASH_TRAITS_HPP
#include <ActivBoost/type_traits/make_void.hpp>
#include <ActivBoost/type_traits/integral_constant.hpp>
namespace Boost{
namespace unordered{
namespace detail{
template<typename Hash,typename=void>
struct hash_is_avalanching_impl: Boost::false_type{};
template<typename Hash>
struct hash_is_avalanching_impl<Hash,
typename Boost::make_void<typename Hash::is_avalanching>::type>:
Boost::true_type{};
} /* namespace detail */
/* Each trait can be partially specialized by users for concrete hash functions
* when actual characterization differs from default.
*/
/* hash_is_avalanching<Hash>::value is true when the type Hash::is_avalanching
* is present, false otherwise.
*/
template<typename Hash>
struct hash_is_avalanching: detail::hash_is_avalanching_impl<Hash>::type{};
} /* namespace unordered */
} /* namespace Boost */
#endif
@@ -1,732 +0,0 @@
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_UNORDERED_FLAT_MAP_HPP_INCLUDED
#define ACTIV_BOOST_UNORDERED_UNORDERED_FLAT_MAP_HPP_INCLUDED
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/unordered/detail/foa.hpp>
#include <ActivBoost/unordered/detail/type_traits.hpp>
#include <ActivBoost/unordered/unordered_flat_map_fwd.hpp>
#include <ActivBoost/core/allocator_access.hpp>
#include <ActivBoost/functional/hash.hpp>
#include <ActivBoost/throw_exception.hpp>
#include <initializer_list>
#include <iterator>
#include <stdexcept>
#include <type_traits>
#include <utility>
namespace Boost {
namespace unordered {
#if defined(ACTIV_BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable : 4714) /* marked as __forceinline not inlined */
#endif
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
class unordered_flat_map
{
struct map_types
{
using key_type = Key;
using raw_key_type = typename std::remove_const<Key>::type;
using raw_mapped_type = typename std::remove_const<T>::type;
using init_type = std::pair<raw_key_type, raw_mapped_type>;
using moved_type = std::pair<raw_key_type&&, raw_mapped_type&&>;
using value_type = std::pair<Key const, T>;
template <class K, class V>
static raw_key_type const& extract(std::pair<K, V> const& kv)
{
return kv.first;
}
static moved_type move(value_type& x)
{
// TODO: we probably need to launder here
return {std::move(const_cast<raw_key_type&>(x.first)),
std::move(const_cast<raw_mapped_type&>(x.second))};
}
};
using table_type = detail::foa::table<map_types, Hash, KeyEqual,
typename Boost::allocator_rebind<Allocator,
typename map_types::value_type>::type>;
table_type table_;
template <class K, class V, class H, class KE, class A, class Pred>
typename unordered_flat_map<K, V, H, KE, A>::size_type friend erase_if(
unordered_flat_map<K, V, H, KE, A>& set, Pred pred);
public:
using key_type = Key;
using mapped_type = T;
using value_type = typename map_types::value_type;
using init_type = typename map_types::init_type;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using hasher = typename Boost::type_identity<Hash>::type;
using key_equal = typename Boost::type_identity<KeyEqual>::type;
using allocator_type = typename Boost::type_identity<Allocator>::type;
using reference = value_type&;
using const_reference = value_type const&;
using pointer = typename Boost::allocator_pointer<allocator_type>::type;
using const_pointer =
typename Boost::allocator_const_pointer<allocator_type>::type;
using iterator = typename table_type::iterator;
using const_iterator = typename table_type::const_iterator;
unordered_flat_map() : unordered_flat_map(0) {}
explicit unordered_flat_map(size_type n, hasher const& h = hasher(),
key_equal const& pred = key_equal(),
allocator_type const& a = allocator_type())
: table_(n, h, pred, a)
{
}
unordered_flat_map(size_type n, allocator_type const& a)
: unordered_flat_map(n, hasher(), key_equal(), a)
{
}
unordered_flat_map(size_type n, hasher const& h, allocator_type const& a)
: unordered_flat_map(n, h, key_equal(), a)
{
}
template <class InputIterator>
unordered_flat_map(
InputIterator f, InputIterator l, allocator_type const& a)
: unordered_flat_map(f, l, size_type(0), hasher(), key_equal(), a)
{
}
explicit unordered_flat_map(allocator_type const& a)
: unordered_flat_map(0, a)
{
}
template <class Iterator>
unordered_flat_map(Iterator first, Iterator last, size_type n = 0,
hasher const& h = hasher(), key_equal const& pred = key_equal(),
allocator_type const& a = allocator_type())
: unordered_flat_map(n, h, pred, a)
{
this->insert(first, last);
}
template <class Iterator>
unordered_flat_map(
Iterator first, Iterator last, size_type n, allocator_type const& a)
: unordered_flat_map(first, last, n, hasher(), key_equal(), a)
{
}
template <class Iterator>
unordered_flat_map(Iterator first, Iterator last, size_type n,
hasher const& h, allocator_type const& a)
: unordered_flat_map(first, last, n, h, key_equal(), a)
{
}
unordered_flat_map(unordered_flat_map const& other) : table_(other.table_)
{
}
unordered_flat_map(
unordered_flat_map const& other, allocator_type const& a)
: table_(other.table_, a)
{
}
unordered_flat_map(unordered_flat_map&& other)
noexcept(std::is_nothrow_move_constructible<hasher>::value&&
std::is_nothrow_move_constructible<key_equal>::value&&
std::is_nothrow_move_constructible<allocator_type>::value)
: table_(std::move(other.table_))
{
}
unordered_flat_map(unordered_flat_map&& other, allocator_type const& al)
: table_(std::move(other.table_), al)
{
}
unordered_flat_map(std::initializer_list<value_type> ilist,
size_type n = 0, hasher const& h = hasher(),
key_equal const& pred = key_equal(),
allocator_type const& a = allocator_type())
: unordered_flat_map(ilist.begin(), ilist.end(), n, h, pred, a)
{
}
unordered_flat_map(
std::initializer_list<value_type> il, allocator_type const& a)
: unordered_flat_map(il, size_type(0), hasher(), key_equal(), a)
{
}
unordered_flat_map(std::initializer_list<value_type> init, size_type n,
allocator_type const& a)
: unordered_flat_map(init, n, hasher(), key_equal(), a)
{
}
unordered_flat_map(std::initializer_list<value_type> init, size_type n,
hasher const& h, allocator_type const& a)
: unordered_flat_map(init, n, h, key_equal(), a)
{
}
~unordered_flat_map() = default;
unordered_flat_map& operator=(unordered_flat_map const& other)
{
table_ = other.table_;
return *this;
}
unordered_flat_map& operator=(unordered_flat_map&& other) noexcept(
noexcept(std::declval<table_type&>() = std::declval<table_type&&>()))
{
table_ = std::move(other.table_);
return *this;
}
allocator_type get_allocator() const noexcept
{
return table_.get_allocator();
}
/// Iterators
///
iterator begin() noexcept { return table_.begin(); }
const_iterator begin() const noexcept { return table_.begin(); }
const_iterator cbegin() const noexcept { return table_.cbegin(); }
iterator end() noexcept { return table_.end(); }
const_iterator end() const noexcept { return table_.end(); }
const_iterator cend() const noexcept { return table_.cend(); }
/// Capacity
///
ACTIV_BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{
return table_.empty();
}
size_type size() const noexcept { return table_.size(); }
size_type max_size() const noexcept { return table_.max_size(); }
/// Modifiers
///
void clear() noexcept { table_.clear(); }
template <class Ty>
ACTIV_BOOST_FORCEINLINE auto insert(Ty&& value)
-> decltype(table_.insert(std::forward<Ty>(value)))
{
return table_.insert(std::forward<Ty>(value));
}
ACTIV_BOOST_FORCEINLINE std::pair<iterator, bool> insert(init_type&& value)
{
return table_.insert(std::move(value));
}
template <class Ty>
ACTIV_BOOST_FORCEINLINE auto insert(const_iterator, Ty&& value)
-> decltype(table_.insert(std::forward<Ty>(value)).first)
{
return table_.insert(std::forward<Ty>(value)).first;
}
ACTIV_BOOST_FORCEINLINE iterator insert(const_iterator, init_type&& value)
{
return table_.insert(std::move(value)).first;
}
template <class InputIterator>
ACTIV_BOOST_FORCEINLINE void insert(InputIterator first, InputIterator last)
{
for (auto pos = first; pos != last; ++pos) {
table_.emplace(*pos);
}
}
void insert(std::initializer_list<value_type> ilist)
{
this->insert(ilist.begin(), ilist.end());
}
template <class M>
std::pair<iterator, bool> insert_or_assign(key_type const& key, M&& obj)
{
auto iter_bool_pair = table_.try_emplace(key, std::forward<M>(obj));
if (iter_bool_pair.second) {
return iter_bool_pair;
}
iter_bool_pair.first->second = std::forward<M>(obj);
return iter_bool_pair;
}
template <class M>
std::pair<iterator, bool> insert_or_assign(key_type&& key, M&& obj)
{
auto iter_bool_pair =
table_.try_emplace(std::move(key), std::forward<M>(obj));
if (iter_bool_pair.second) {
return iter_bool_pair;
}
iter_bool_pair.first->second = std::forward<M>(obj);
return iter_bool_pair;
}
template <class M>
iterator insert_or_assign(const_iterator, key_type const& key, M&& obj)
{
return this->insert_or_assign(key, std::forward<M>(obj)).first;
}
template <class M>
iterator insert_or_assign(const_iterator, key_type&& key, M&& obj)
{
return this->insert_or_assign(std::move(key), std::forward<M>(obj))
.first;
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE std::pair<iterator, bool> emplace(Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...);
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE iterator emplace_hint(const_iterator, Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...).first;
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE std::pair<iterator, bool> try_emplace(
key_type const& key, Args&&... args)
{
return table_.try_emplace(key, std::forward<Args>(args)...);
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE std::pair<iterator, bool> try_emplace(
key_type&& key, Args&&... args)
{
return table_.try_emplace(std::move(key), std::forward<Args>(args)...);
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE iterator try_emplace(
const_iterator, key_type const& key, Args&&... args)
{
return table_.try_emplace(key, std::forward<Args>(args)...).first;
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE iterator try_emplace(
const_iterator, key_type&& key, Args&&... args)
{
return table_.try_emplace(std::move(key), std::forward<Args>(args)...)
.first;
}
ACTIV_BOOST_FORCEINLINE void erase(iterator pos) { table_.erase(pos); }
ACTIV_BOOST_FORCEINLINE void erase(const_iterator pos)
{
return table_.erase(pos);
}
iterator erase(const_iterator first, const_iterator last)
{
while (first != last) {
this->erase(first++);
}
return iterator{detail::foa::const_iterator_cast_tag{}, last};
}
ACTIV_BOOST_FORCEINLINE size_type erase(key_type const& key)
{
return table_.erase(key);
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
detail::transparent_non_iterable<K, unordered_flat_map>::value,
size_type>::type
erase(K const& key)
{
return table_.erase(key);
}
void swap(unordered_flat_map& rhs) noexcept(
noexcept(std::declval<table_type&>().swap(std::declval<table_type&>())))
{
table_.swap(rhs.table_);
}
template <class H2, class P2>
void merge(
unordered_flat_map<key_type, mapped_type, H2, P2, allocator_type>&
source)
{
table_.merge(source.table_);
}
template <class H2, class P2>
void merge(
unordered_flat_map<key_type, mapped_type, H2, P2, allocator_type>&&
source)
{
table_.merge(std::move(source.table_));
}
/// Lookup
///
mapped_type& at(key_type const& key)
{
auto pos = table_.find(key);
if (pos != table_.end()) {
return pos->second;
}
// TODO: someday refactor this to conditionally serialize the key and
// include it in the error message
//
Boost::throw_exception(
std::out_of_range("key was not found in unordered_flat_map"));
}
mapped_type const& at(key_type const& key) const
{
auto pos = table_.find(key);
if (pos != table_.end()) {
return pos->second;
}
Boost::throw_exception(
std::out_of_range("key was not found in unordered_flat_map"));
}
ACTIV_BOOST_FORCEINLINE mapped_type& operator[](key_type const& key)
{
return table_.try_emplace(key).first->second;
}
ACTIV_BOOST_FORCEINLINE mapped_type& operator[](key_type&& key)
{
return table_.try_emplace(std::move(key)).first->second;
}
ACTIV_BOOST_FORCEINLINE size_type count(key_type const& key) const
{
auto pos = table_.find(key);
return pos != table_.end() ? 1 : 0;
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value, size_type>::type
count(K const& key) const
{
auto pos = table_.find(key);
return pos != table_.end() ? 1 : 0;
}
ACTIV_BOOST_FORCEINLINE iterator find(key_type const& key)
{
return table_.find(key);
}
ACTIV_BOOST_FORCEINLINE const_iterator find(key_type const& key) const
{
return table_.find(key);
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
Boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
iterator>::type
find(K const& key)
{
return table_.find(key);
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
Boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
const_iterator>::type
find(K const& key) const
{
return table_.find(key);
}
ACTIV_BOOST_FORCEINLINE bool contains(key_type const& key) const
{
return this->find(key) != this->end();
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
Boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
bool>::type
contains(K const& key) const
{
return this->find(key) != this->end();
}
std::pair<iterator, iterator> equal_range(key_type const& key)
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
std::pair<const_iterator, const_iterator> equal_range(
key_type const& key) const
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<iterator, iterator> >::type
equal_range(K const& key)
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<const_iterator, const_iterator> >::type
equal_range(K const& key) const
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
/// Hash Policy
///
size_type bucket_count() const noexcept { return table_.capacity(); }
float load_factor() const noexcept { return table_.load_factor(); }
float max_load_factor() const noexcept
{
return table_.max_load_factor();
}
void max_load_factor(float) {}
size_type max_load() const noexcept { return table_.max_load(); }
void rehash(size_type n) { table_.rehash(n); }
void reserve(size_type n) { table_.reserve(n); }
/// Observers
///
hasher hash_function() const { return table_.hash_function(); }
key_equal key_eq() const { return table_.key_eq(); }
};
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
bool operator==(
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& rhs)
{
if (&lhs == &rhs) {
return true;
}
return (lhs.size() == rhs.size()) && ([&] {
for (auto const& kvp : lhs) {
auto pos = rhs.find(kvp.first);
if ((pos == rhs.end()) || (*pos != kvp)) {
return false;
}
}
return true;
})();
}
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
bool operator!=(
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& rhs)
{
return !(lhs == rhs);
}
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
void swap(unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& lhs,
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& rhs)
noexcept(noexcept(lhs.swap(rhs)))
{
lhs.swap(rhs);
}
template <class Key, class T, class Hash, class KeyEqual, class Allocator,
class Pred>
typename unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>::size_type
erase_if(
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& map, Pred pred)
{
return erase_if(map.table_, pred);
}
#if defined(ACTIV_BOOST_MSVC)
#pragma warning(pop) /* C4714 */
#endif
#if ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
namespace detail {
template <typename T>
using iter_key_t =
typename std::iterator_traits<T>::value_type::first_type;
template <typename T>
using iter_val_t =
typename std::iterator_traits<T>::value_type::second_type;
template <typename T>
using iter_to_alloc_t =
typename std::pair<iter_key_t<T> const, iter_val_t<T> >;
} // namespace detail
template <class InputIterator,
class Hash =
Boost::hash<Boost::unordered::detail::iter_key_t<InputIterator> >,
class Pred =
std::equal_to<Boost::unordered::detail::iter_key_t<InputIterator> >,
class Allocator = std::allocator<
Boost::unordered::detail::iter_to_alloc_t<InputIterator> >,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_pred_v<Pred> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(InputIterator, InputIterator,
std::size_t = Boost::unordered::detail::foa::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_flat_map<Boost::unordered::detail::iter_key_t<InputIterator>,
Boost::unordered::detail::iter_val_t<InputIterator>, Hash, Pred,
Allocator>;
template <class Key, class T,
class Hash = Boost::hash<Boost::remove_const_t<Key> >,
class Pred = std::equal_to<Boost::remove_const_t<Key> >,
class Allocator = std::allocator<std::pair<const Key, T> >,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_pred_v<Pred> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(std::initializer_list<std::pair<Key, T> >,
std::size_t = Boost::unordered::detail::foa::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_flat_map<Boost::remove_const_t<Key>, T, Hash, Pred,
Allocator>;
template <class InputIterator, class Allocator,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(InputIterator, InputIterator, std::size_t, Allocator)
-> unordered_flat_map<Boost::unordered::detail::iter_key_t<InputIterator>,
Boost::unordered::detail::iter_val_t<InputIterator>,
Boost::hash<Boost::unordered::detail::iter_key_t<InputIterator> >,
std::equal_to<Boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>;
template <class InputIterator, class Allocator,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(InputIterator, InputIterator, Allocator)
-> unordered_flat_map<Boost::unordered::detail::iter_key_t<InputIterator>,
Boost::unordered::detail::iter_val_t<InputIterator>,
Boost::hash<Boost::unordered::detail::iter_key_t<InputIterator> >,
std::equal_to<Boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>;
template <class InputIterator, class Hash, class Allocator,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(
InputIterator, InputIterator, std::size_t, Hash, Allocator)
-> unordered_flat_map<Boost::unordered::detail::iter_key_t<InputIterator>,
Boost::unordered::detail::iter_val_t<InputIterator>, Hash,
std::equal_to<Boost::unordered::detail::iter_key_t<InputIterator> >,
Allocator>;
template <class Key, class T, class Allocator,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Allocator) -> unordered_flat_map<Boost::remove_const_t<Key>, T,
Boost::hash<Boost::remove_const_t<Key> >,
std::equal_to<Boost::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Allocator,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(std::initializer_list<std::pair<Key, T> >, Allocator)
-> unordered_flat_map<Boost::remove_const_t<Key>, T,
Boost::hash<Boost::remove_const_t<Key> >,
std::equal_to<Boost::remove_const_t<Key> >, Allocator>;
template <class Key, class T, class Hash, class Allocator,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_map(std::initializer_list<std::pair<Key, T> >, std::size_t,
Hash, Allocator) -> unordered_flat_map<Boost::remove_const_t<Key>, T,
Hash, std::equal_to<Boost::remove_const_t<Key> >, Allocator>;
#endif
} // namespace unordered
} // namespace Boost
#endif
@@ -1,49 +0,0 @@
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_FLAT_MAP_FWD_HPP_INCLUDED
#define ACTIV_BOOST_UNORDERED_FLAT_MAP_FWD_HPP_INCLUDED
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/functional/hash_fwd.hpp>
#include <ActivBoost/unordered/detail/fwd.hpp>
#include <functional>
#include <memory>
namespace Boost {
namespace unordered {
template <class Key, class T, class Hash = Boost::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator = std::allocator<std::pair<const Key, T> > >
class unordered_flat_map;
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
bool operator==(
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& rhs);
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
bool operator!=(
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator> const& rhs);
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
void swap(unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& lhs,
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& rhs)
noexcept(noexcept(lhs.swap(rhs)));
} // namespace unordered
using Boost::unordered::unordered_flat_map;
using Boost::unordered::swap;
using Boost::unordered::operator==;
using Boost::unordered::operator!=;
} // namespace Boost
#endif
@@ -1,586 +0,0 @@
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_UNORDERED_FLAT_SET_HPP_INCLUDED
#define ACTIV_BOOST_UNORDERED_UNORDERED_FLAT_SET_HPP_INCLUDED
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/unordered/detail/foa.hpp>
#include <ActivBoost/unordered/detail/type_traits.hpp>
#include <ActivBoost/unordered/unordered_flat_set_fwd.hpp>
#include <ActivBoost/core/allocator_access.hpp>
#include <ActivBoost/functional/hash.hpp>
#include <initializer_list>
#include <iterator>
#include <type_traits>
#include <utility>
namespace Boost {
namespace unordered {
#if defined(ACTIV_BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable : 4714) /* marked as __forceinline not inlined */
#endif
template <class Key, class Hash, class KeyEqual, class Allocator>
class unordered_flat_set
{
struct set_types
{
using key_type = Key;
using init_type = Key;
using value_type = Key;
static Key const& extract(value_type const& key) { return key; }
static Key&& move(value_type& x) { return std::move(x); }
};
using table_type = detail::foa::table<set_types, Hash, KeyEqual,
typename Boost::allocator_rebind<Allocator,
typename set_types::value_type>::type>;
table_type table_;
template <class K, class H, class KE, class A, class Pred>
typename unordered_flat_set<K, H, KE, A>::size_type friend erase_if(
unordered_flat_set<K, H, KE, A>& set, Pred pred);
public:
using key_type = Key;
using value_type = typename set_types::value_type;
using init_type = typename set_types::init_type;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using hasher = Hash;
using key_equal = KeyEqual;
using allocator_type = Allocator;
using reference = value_type&;
using const_reference = value_type const&;
using pointer = typename Boost::allocator_pointer<allocator_type>::type;
using const_pointer =
typename Boost::allocator_const_pointer<allocator_type>::type;
using iterator = typename table_type::iterator;
using const_iterator = typename table_type::const_iterator;
unordered_flat_set() : unordered_flat_set(0) {}
explicit unordered_flat_set(size_type n, hasher const& h = hasher(),
key_equal const& pred = key_equal(),
allocator_type const& a = allocator_type())
: table_(n, h, pred, a)
{
}
unordered_flat_set(size_type n, allocator_type const& a)
: unordered_flat_set(n, hasher(), key_equal(), a)
{
}
unordered_flat_set(size_type n, hasher const& h, allocator_type const& a)
: unordered_flat_set(n, h, key_equal(), a)
{
}
template <class InputIterator>
unordered_flat_set(
InputIterator f, InputIterator l, allocator_type const& a)
: unordered_flat_set(f, l, size_type(0), hasher(), key_equal(), a)
{
}
explicit unordered_flat_set(allocator_type const& a)
: unordered_flat_set(0, a)
{
}
template <class Iterator>
unordered_flat_set(Iterator first, Iterator last, size_type n = 0,
hasher const& h = hasher(), key_equal const& pred = key_equal(),
allocator_type const& a = allocator_type())
: unordered_flat_set(n, h, pred, a)
{
this->insert(first, last);
}
template <class InputIt>
unordered_flat_set(
InputIt first, InputIt last, size_type n, allocator_type const& a)
: unordered_flat_set(first, last, n, hasher(), key_equal(), a)
{
}
template <class Iterator>
unordered_flat_set(Iterator first, Iterator last, size_type n,
hasher const& h, allocator_type const& a)
: unordered_flat_set(first, last, n, h, key_equal(), a)
{
}
unordered_flat_set(unordered_flat_set const& other) : table_(other.table_)
{
}
unordered_flat_set(
unordered_flat_set const& other, allocator_type const& a)
: table_(other.table_, a)
{
}
unordered_flat_set(unordered_flat_set&& other)
noexcept(std::is_nothrow_move_constructible<hasher>::value&&
std::is_nothrow_move_constructible<key_equal>::value&&
std::is_nothrow_move_constructible<allocator_type>::value)
: table_(std::move(other.table_))
{
}
unordered_flat_set(unordered_flat_set&& other, allocator_type const& al)
: table_(std::move(other.table_), al)
{
}
unordered_flat_set(std::initializer_list<value_type> ilist,
size_type n = 0, hasher const& h = hasher(),
key_equal const& pred = key_equal(),
allocator_type const& a = allocator_type())
: unordered_flat_set(ilist.begin(), ilist.end(), n, h, pred, a)
{
}
unordered_flat_set(
std::initializer_list<value_type> il, allocator_type const& a)
: unordered_flat_set(il, size_type(0), hasher(), key_equal(), a)
{
}
unordered_flat_set(std::initializer_list<value_type> init, size_type n,
allocator_type const& a)
: unordered_flat_set(init, n, hasher(), key_equal(), a)
{
}
unordered_flat_set(std::initializer_list<value_type> init, size_type n,
hasher const& h, allocator_type const& a)
: unordered_flat_set(init, n, h, key_equal(), a)
{
}
~unordered_flat_set() = default;
unordered_flat_set& operator=(unordered_flat_set const& other)
{
table_ = other.table_;
return *this;
}
unordered_flat_set& operator=(unordered_flat_set&& other) noexcept(
noexcept(std::declval<table_type&>() = std::declval<table_type&&>()))
{
table_ = std::move(other.table_);
return *this;
}
allocator_type get_allocator() const noexcept
{
return table_.get_allocator();
}
/// Iterators
///
iterator begin() noexcept { return table_.begin(); }
const_iterator begin() const noexcept { return table_.begin(); }
const_iterator cbegin() const noexcept { return table_.cbegin(); }
iterator end() noexcept { return table_.end(); }
const_iterator end() const noexcept { return table_.end(); }
const_iterator cend() const noexcept { return table_.cend(); }
/// Capacity
///
ACTIV_BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
{
return table_.empty();
}
size_type size() const noexcept { return table_.size(); }
size_type max_size() const noexcept { return table_.max_size(); }
/// Modifiers
///
void clear() noexcept { table_.clear(); }
ACTIV_BOOST_FORCEINLINE std::pair<iterator, bool> insert(
value_type const& value)
{
return table_.insert(value);
}
ACTIV_BOOST_FORCEINLINE std::pair<iterator, bool> insert(value_type&& value)
{
return table_.insert(std::move(value));
}
ACTIV_BOOST_FORCEINLINE iterator insert(const_iterator, value_type const& value)
{
return table_.insert(value).first;
}
ACTIV_BOOST_FORCEINLINE iterator insert(const_iterator, value_type&& value)
{
return table_.insert(std::move(value)).first;
}
template <class InputIterator>
void insert(InputIterator first, InputIterator last)
{
for (auto pos = first; pos != last; ++pos) {
table_.emplace(*pos);
}
}
void insert(std::initializer_list<value_type> ilist)
{
this->insert(ilist.begin(), ilist.end());
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE std::pair<iterator, bool> emplace(Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...);
}
template <class... Args>
ACTIV_BOOST_FORCEINLINE iterator emplace_hint(const_iterator, Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...).first;
}
ACTIV_BOOST_FORCEINLINE void erase(const_iterator pos)
{
return table_.erase(pos);
}
iterator erase(const_iterator first, const_iterator last)
{
while (first != last) {
this->erase(first++);
}
return iterator{detail::foa::const_iterator_cast_tag{}, last};
}
ACTIV_BOOST_FORCEINLINE size_type erase(key_type const& key)
{
return table_.erase(key);
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
detail::transparent_non_iterable<K, unordered_flat_set>::value,
size_type>::type
erase(K const& key)
{
return table_.erase(key);
}
void swap(unordered_flat_set& rhs) noexcept(
noexcept(std::declval<table_type&>().swap(std::declval<table_type&>())))
{
table_.swap(rhs.table_);
}
template <class H2, class P2>
void merge(unordered_flat_set<key_type, H2, P2, allocator_type>& source)
{
table_.merge(source.table_);
}
template <class H2, class P2>
void merge(unordered_flat_set<key_type, H2, P2, allocator_type>&& source)
{
table_.merge(std::move(source.table_));
}
/// Lookup
///
ACTIV_BOOST_FORCEINLINE size_type count(key_type const& key) const
{
auto pos = table_.find(key);
return pos != table_.end() ? 1 : 0;
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value, size_type>::type
count(K const& key) const
{
auto pos = table_.find(key);
return pos != table_.end() ? 1 : 0;
}
ACTIV_BOOST_FORCEINLINE iterator find(key_type const& key)
{
return table_.find(key);
}
ACTIV_BOOST_FORCEINLINE const_iterator find(key_type const& key) const
{
return table_.find(key);
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
Boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
iterator>::type
find(K const& key)
{
return table_.find(key);
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
Boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
const_iterator>::type
find(K const& key) const
{
return table_.find(key);
}
ACTIV_BOOST_FORCEINLINE bool contains(key_type const& key) const
{
return this->find(key) != this->end();
}
template <class K>
ACTIV_BOOST_FORCEINLINE typename std::enable_if<
Boost::unordered::detail::are_transparent<K, hasher, key_equal>::value,
bool>::type
contains(K const& key) const
{
return this->find(key) != this->end();
}
std::pair<iterator, iterator> equal_range(key_type const& key)
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
std::pair<const_iterator, const_iterator> equal_range(
key_type const& key) const
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<iterator, iterator> >::type
equal_range(K const& key)
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<const_iterator, const_iterator> >::type
equal_range(K const& key) const
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
/// Hash Policy
///
size_type bucket_count() const noexcept { return table_.capacity(); }
float load_factor() const noexcept { return table_.load_factor(); }
float max_load_factor() const noexcept
{
return table_.max_load_factor();
}
void max_load_factor(float) {}
size_type max_load() const noexcept { return table_.max_load(); }
void rehash(size_type n) { table_.rehash(n); }
void reserve(size_type n) { table_.reserve(n); }
/// Observers
///
hasher hash_function() const { return table_.hash_function(); }
key_equal key_eq() const { return table_.key_eq(); }
};
template <class Key, class Hash, class KeyEqual, class Allocator>
bool operator==(
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& rhs)
{
if (&lhs == &rhs) {
return true;
}
return (lhs.size() == rhs.size()) && ([&] {
for (auto const& key : lhs) {
auto pos = rhs.find(key);
if ((pos == rhs.end()) || (key != *pos)) {
return false;
}
}
return true;
})();
}
template <class Key, class Hash, class KeyEqual, class Allocator>
bool operator!=(
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& rhs)
{
return !(lhs == rhs);
}
template <class Key, class Hash, class KeyEqual, class Allocator>
void swap(unordered_flat_set<Key, Hash, KeyEqual, Allocator>& lhs,
unordered_flat_set<Key, Hash, KeyEqual, Allocator>& rhs)
noexcept(noexcept(lhs.swap(rhs)))
{
lhs.swap(rhs);
}
template <class Key, class Hash, class KeyEqual, class Allocator,
class Pred>
typename unordered_flat_set<Key, Hash, KeyEqual, Allocator>::size_type
erase_if(unordered_flat_set<Key, Hash, KeyEqual, Allocator>& set, Pred pred)
{
return erase_if(set.table_, pred);
}
#if defined(ACTIV_BOOST_MSVC)
#pragma warning(pop) /* C4714 */
#endif
#if ACTIV_BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES
template <class InputIterator,
class Hash =
Boost::hash<typename std::iterator_traits<InputIterator>::value_type>,
class Pred =
std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
class Allocator = std::allocator<
typename std::iterator_traits<InputIterator>::value_type>,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_pred_v<Pred> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(InputIterator, InputIterator,
std::size_t = Boost::unordered::detail::foa::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_flat_set<
typename std::iterator_traits<InputIterator>::value_type, Hash, Pred,
Allocator>;
template <class T, class Hash = Boost::hash<T>,
class Pred = std::equal_to<T>, class Allocator = std::allocator<T>,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_pred_v<Pred> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(std::initializer_list<T>,
std::size_t = Boost::unordered::detail::foa::default_bucket_count,
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
-> unordered_flat_set<T, Hash, Pred, Allocator>;
template <class InputIterator, class Allocator,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(InputIterator, InputIterator, std::size_t, Allocator)
-> unordered_flat_set<
typename std::iterator_traits<InputIterator>::value_type,
Boost::hash<typename std::iterator_traits<InputIterator>::value_type>,
std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
Allocator>;
template <class InputIterator, class Hash, class Allocator,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(
InputIterator, InputIterator, std::size_t, Hash, Allocator)
-> unordered_flat_set<
typename std::iterator_traits<InputIterator>::value_type, Hash,
std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
Allocator>;
template <class T, class Allocator,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(std::initializer_list<T>, std::size_t, Allocator)
-> unordered_flat_set<T, Boost::hash<T>, std::equal_to<T>, Allocator>;
template <class T, class Hash, class Allocator,
class = Boost::enable_if_t<detail::is_hash_v<Hash> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(std::initializer_list<T>, std::size_t, Hash, Allocator)
-> unordered_flat_set<T, Hash, std::equal_to<T>, Allocator>;
template <class InputIterator, class Allocator,
class = Boost::enable_if_t<detail::is_input_iterator_v<InputIterator> >,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(InputIterator, InputIterator, Allocator)
-> unordered_flat_set<
typename std::iterator_traits<InputIterator>::value_type,
Boost::hash<typename std::iterator_traits<InputIterator>::value_type>,
std::equal_to<typename std::iterator_traits<InputIterator>::value_type>,
Allocator>;
template <class T, class Allocator,
class = Boost::enable_if_t<detail::is_allocator_v<Allocator> > >
unordered_flat_set(std::initializer_list<T>, Allocator)
-> unordered_flat_set<T, Boost::hash<T>, std::equal_to<T>, Allocator>;
#endif
} // namespace unordered
} // namespace Boost
#endif
@@ -1,49 +0,0 @@
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_FLAT_SET_FWD_HPP_INCLUDED
#define ACTIV_BOOST_UNORDERED_FLAT_SET_FWD_HPP_INCLUDED
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/functional/hash_fwd.hpp>
#include <ActivBoost/unordered/detail/fwd.hpp>
#include <functional>
#include <memory>
namespace Boost {
namespace unordered {
template <class Key, class Hash = Boost::hash<Key>,
class KeyEqual = std::equal_to<Key>,
class Allocator = std::allocator<Key> >
class unordered_flat_set;
template <class Key, class Hash, class KeyEqual, class Allocator>
bool operator==(
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& rhs);
template <class Key, class Hash, class KeyEqual, class Allocator>
bool operator!=(
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& lhs,
unordered_flat_set<Key, Hash, KeyEqual, Allocator> const& rhs);
template <class Key, class Hash, class KeyEqual, class Allocator>
void swap(unordered_flat_set<Key, Hash, KeyEqual, Allocator>& lhs,
unordered_flat_set<Key, Hash, KeyEqual, Allocator>& rhs)
noexcept(noexcept(lhs.swap(rhs)));
} // namespace unordered
using Boost::unordered::unordered_flat_set;
using Boost::unordered::swap;
using Boost::unordered::operator==;
using Boost::unordered::operator!=;
} // namespace Boost
#endif
File diff suppressed because it is too large. Load diff
@@ -1,73 +0,0 @@
// Copyright (C) 2008-2011 Daniel James.
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_MAP_FWD_HPP_INCLUDED
#define ACTIV_BOOST_UNORDERED_MAP_FWD_HPP_INCLUDED
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/functional/hash_fwd.hpp>
#include <ActivBoost/unordered/detail/fwd.hpp>
#include <functional>
#include <memory>
namespace Boost {
namespace unordered {
template <class K, class T, class H = Boost::hash<K>,
class P = std::equal_to<K>,
class A = std::allocator<std::pair<const K, T> > >
class unordered_map;
template <class K, class T, class H, class P, class A>
inline bool operator==(
unordered_map<K, T, H, P, A> const&, unordered_map<K, T, H, P, A> const&);
template <class K, class T, class H, class P, class A>
inline bool operator!=(
unordered_map<K, T, H, P, A> const&, unordered_map<K, T, H, P, A> const&);
template <class K, class T, class H, class P, class A>
inline void swap(
unordered_map<K, T, H, P, A>& m1, unordered_map<K, T, H, P, A>& m2)
ACTIV_BOOST_NOEXCEPT_IF(ACTIV_BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class T, class H, class P, class A, class Predicate>
typename unordered_map<K, T, H, P, A>::size_type erase_if(
unordered_map<K, T, H, P, A>& c, Predicate pred);
template <class K, class T, class H = Boost::hash<K>,
class P = std::equal_to<K>,
class A = std::allocator<std::pair<const K, T> > >
class unordered_multimap;
template <class K, class T, class H, class P, class A>
inline bool operator==(unordered_multimap<K, T, H, P, A> const&,
unordered_multimap<K, T, H, P, A> const&);
template <class K, class T, class H, class P, class A>
inline bool operator!=(unordered_multimap<K, T, H, P, A> const&,
unordered_multimap<K, T, H, P, A> const&);
template <class K, class T, class H, class P, class A>
inline void swap(unordered_multimap<K, T, H, P, A>& m1,
unordered_multimap<K, T, H, P, A>& m2)
ACTIV_BOOST_NOEXCEPT_IF(ACTIV_BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class T, class H, class P, class A, class Predicate>
typename unordered_multimap<K, T, H, P, A>::size_type erase_if(
unordered_multimap<K, T, H, P, A>& c, Predicate pred);
template <class N, class K, class T, class A> class node_handle_map;
template <class Iter, class NodeType> struct insert_return_type_map;
}
using Boost::unordered::unordered_map;
using Boost::unordered::unordered_multimap;
using Boost::unordered::swap;
using Boost::unordered::operator==;
using Boost::unordered::operator!=;
}
#endif
File diff suppressed because it is too large. Load diff
@@ -1,71 +0,0 @@
// Copyright (C) 2008-2011 Daniel James.
// Copyright (C) 2022 Christian Mazakas
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef ACTIV_BOOST_UNORDERED_SET_FWD_HPP_INCLUDED
#define ACTIV_BOOST_UNORDERED_SET_FWD_HPP_INCLUDED
#include <ActivBoost/config.hpp>
#if defined(ACTIV_BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <ActivBoost/functional/hash_fwd.hpp>
#include <ActivBoost/unordered/detail/fwd.hpp>
#include <functional>
#include <memory>
namespace Boost {
namespace unordered {
template <class T, class H = Boost::hash<T>, class P = std::equal_to<T>,
class A = std::allocator<T> >
class unordered_set;
template <class T, class H, class P, class A>
inline bool operator==(
unordered_set<T, H, P, A> const&, unordered_set<T, H, P, A> const&);
template <class T, class H, class P, class A>
inline bool operator!=(
unordered_set<T, H, P, A> const&, unordered_set<T, H, P, A> const&);
template <class T, class H, class P, class A>
inline void swap(
unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2)
ACTIV_BOOST_NOEXCEPT_IF(ACTIV_BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class H, class P, class A, class Predicate>
typename unordered_set<K, H, P, A>::size_type erase_if(
unordered_set<K, H, P, A>& c, Predicate pred);
template <class T, class H = Boost::hash<T>, class P = std::equal_to<T>,
class A = std::allocator<T> >
class unordered_multiset;
template <class T, class H, class P, class A>
inline bool operator==(unordered_multiset<T, H, P, A> const&,
unordered_multiset<T, H, P, A> const&);
template <class T, class H, class P, class A>
inline bool operator!=(unordered_multiset<T, H, P, A> const&,
unordered_multiset<T, H, P, A> const&);
template <class T, class H, class P, class A>
inline void swap(
unordered_multiset<T, H, P, A>& m1, unordered_multiset<T, H, P, A>& m2)
ACTIV_BOOST_NOEXCEPT_IF(ACTIV_BOOST_NOEXCEPT_EXPR(m1.swap(m2)));
template <class K, class H, class P, class A, class Predicate>
typename unordered_multiset<K, H, P, A>::size_type erase_if(
unordered_multiset<K, H, P, A>& c, Predicate pred);
template <class N, class T, class A> class node_handle_set;
template <class Iter, class NodeType> struct insert_return_type_set;
}
using Boost::unordered::unordered_set;
using Boost::unordered::unordered_multiset;
using Boost::unordered::swap;
using Boost::unordered::operator==;
using Boost::unordered::operator!=;
}
#endif