forked from boostorg/unordered
Push up partial refactor for older msvc
This commit is contained in:
@ -134,11 +134,16 @@ namespace foa{
|
|||||||
|
|
||||||
struct group15
|
struct group15
|
||||||
{
|
{
|
||||||
static constexpr int N=15;
|
BOOST_STATIC_CONSTEXPR int N=15;
|
||||||
|
|
||||||
struct dummy_group_type
|
struct dummy_group_type
|
||||||
{
|
{
|
||||||
alignas(16) unsigned char storage[N+1]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0};
|
BOOST_ALIGNMENT(16) unsigned char storage[N+1];
|
||||||
|
|
||||||
|
dummy_group_type() {
|
||||||
|
BOOST_ALIGNMENT(16) unsigned char tmp[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0};
|
||||||
|
std::memcpy(storage, tmp, sizeof(storage));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void initialize(){m=_mm_setzero_si128();}
|
inline void initialize(){m=_mm_setzero_si128();}
|
||||||
@ -179,7 +184,7 @@ struct group15
|
|||||||
|
|
||||||
inline bool is_not_overflowed(std::size_t hash)const
|
inline bool is_not_overflowed(std::size_t hash)const
|
||||||
{
|
{
|
||||||
static constexpr unsigned char shift[]={1,2,4,8,16,32,64,128};
|
BOOST_STATIC_CONSTEXPR unsigned char shift[]={1,2,4,8,16,32,64,128};
|
||||||
|
|
||||||
return !(overflow()&shift[hash%8]);
|
return !(overflow()&shift[hash%8]);
|
||||||
}
|
}
|
||||||
@ -206,12 +211,12 @@ struct group15
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr unsigned char available_=0,
|
BOOST_STATIC_CONSTEXPR unsigned char available_=0,
|
||||||
sentinel_=1;
|
sentinel_=1;
|
||||||
|
|
||||||
inline static int match_word(std::size_t hash)
|
inline static int match_word(std::size_t hash)
|
||||||
{
|
{
|
||||||
static constexpr boost::uint32_t word[]=
|
BOOST_STATIC_CONSTEXPR boost::uint32_t word[]=
|
||||||
{
|
{
|
||||||
0x02020202u,0x03030303u,0x02020202u,0x03030303u,0x04040404u,0x05050505u,0x06060606u,0x07070707u,
|
0x02020202u,0x03030303u,0x02020202u,0x03030303u,0x04040404u,0x05050505u,0x06060606u,0x07070707u,
|
||||||
0x08080808u,0x09090909u,0x0A0A0A0Au,0x0B0B0B0Bu,0x0C0C0C0Cu,0x0D0D0D0Du,0x0E0E0E0Eu,0x0F0F0F0Fu,
|
0x08080808u,0x09090909u,0x0A0A0A0Au,0x0B0B0B0Bu,0x0C0C0C0Cu,0x0D0D0D0Du,0x0E0E0E0Eu,0x0F0F0F0Fu,
|
||||||
@ -275,7 +280,7 @@ private:
|
|||||||
return at(N);
|
return at(N);
|
||||||
}
|
}
|
||||||
|
|
||||||
alignas(16) __m128i m;
|
BOOST_ALIGNMENT(16) __m128i m;
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(BOOST_UNORDERED_LITTLE_ENDIAN_NEON)
|
#elif defined(BOOST_UNORDERED_LITTLE_ENDIAN_NEON)
|
||||||
@ -642,7 +647,8 @@ struct pow2_size_policy
|
|||||||
return std::size_t(1)<<(sizeof(std::size_t)*CHAR_BIT-size_index_);
|
return std::size_t(1)<<(sizeof(std::size_t)*CHAR_BIT-size_index_);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr std::size_t min_size(){return 2;}
|
// static BOOST_CONSTEXPR std::size_t min_size(){return 2;}
|
||||||
|
BOOST_STATIC_CONSTEXPR std::size_t min_size = 2;
|
||||||
|
|
||||||
static inline std::size_t position(std::size_t hash,std::size_t size_index_)
|
static inline std::size_t position(std::size_t hash,std::size_t size_index_)
|
||||||
{
|
{
|
||||||
@ -776,10 +782,10 @@ public:
|
|||||||
const_iterator_cast_tag, const table_iterator<Value,Group,true>& x):
|
const_iterator_cast_tag, const table_iterator<Value,Group,true>& x):
|
||||||
pc{x.pc},p{x.p}{}
|
pc{x.pc},p{x.p}{}
|
||||||
|
|
||||||
inline reference operator*()const noexcept{return *p;}
|
inline reference operator*()const BOOST_NOEXCEPT{return *p;}
|
||||||
inline pointer operator->()const noexcept{return p;}
|
inline pointer operator->()const BOOST_NOEXCEPT{return p;}
|
||||||
inline table_iterator& operator++()noexcept{increment();return *this;}
|
inline table_iterator& operator++()BOOST_NOEXCEPT{increment();return *this;}
|
||||||
inline table_iterator operator++(int)noexcept
|
inline table_iterator operator++(int)BOOST_NOEXCEPT
|
||||||
{auto x=*this;increment();return x;}
|
{auto x=*this;increment();return x;}
|
||||||
friend inline bool operator==(
|
friend inline bool operator==(
|
||||||
const table_iterator& x,const table_iterator& y)
|
const table_iterator& x,const table_iterator& y)
|
||||||
@ -797,14 +803,14 @@ private:
|
|||||||
p{const_cast<Value*>(p_)}
|
p{const_cast<Value*>(p_)}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline std::size_t rebase() noexcept
|
inline std::size_t rebase() BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
std::size_t off=reinterpret_cast<uintptr_t>(pc)%sizeof(Group);
|
std::size_t off=reinterpret_cast<uintptr_t>(pc)%sizeof(Group);
|
||||||
pc-=off;
|
pc-=off;
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void increment()noexcept
|
inline void increment()BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
std::size_t n0=rebase();
|
std::size_t n0=rebase();
|
||||||
|
|
||||||
@ -852,7 +858,7 @@ Group* dummy_groups()
|
|||||||
* insertion as the container's capacity is precisely zero.
|
* insertion as the container's capacity is precisely zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static constexpr typename Group::dummy_group_type
|
BOOST_STATIC_CONSTEXPR typename Group::dummy_group_type
|
||||||
storage[Size]={typename Group::dummy_group_type(),};
|
storage[Size]={typename Group::dummy_group_type(),};
|
||||||
|
|
||||||
return reinterpret_cast<Group*>(
|
return reinterpret_cast<Group*>(
|
||||||
@ -864,7 +870,7 @@ struct table_arrays
|
|||||||
{
|
{
|
||||||
using value_type=Value;
|
using value_type=Value;
|
||||||
using group_type=Group;
|
using group_type=Group;
|
||||||
static constexpr auto N=group_type::N;
|
BOOST_STATIC_CONSTEXPR auto N=group_type::N;
|
||||||
using size_policy=SizePolicy;
|
using size_policy=SizePolicy;
|
||||||
|
|
||||||
template<typename Allocator>
|
template<typename Allocator>
|
||||||
@ -877,7 +883,7 @@ struct table_arrays
|
|||||||
table_arrays arrays{groups_size_index,groups_size-1,nullptr,nullptr};
|
table_arrays arrays{groups_size_index,groups_size-1,nullptr,nullptr};
|
||||||
|
|
||||||
if(!n){
|
if(!n){
|
||||||
arrays.groups=dummy_groups<group_type,size_policy::min_size()>();
|
arrays.groups=dummy_groups<group_type,size_policy::min_size>();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
arrays.elements=
|
arrays.elements=
|
||||||
@ -903,7 +909,7 @@ struct table_arrays
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Allocator>
|
template<typename Allocator>
|
||||||
static void delete_(Allocator& al,table_arrays& arrays)noexcept
|
static void delete_(Allocator& al,table_arrays& arrays)BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
using alloc_traits=boost::allocator_traits<Allocator>;
|
using alloc_traits=boost::allocator_traits<Allocator>;
|
||||||
using pointer=typename alloc_traits::pointer;
|
using pointer=typename alloc_traits::pointer;
|
||||||
@ -1049,7 +1055,7 @@ inline void prefetch(const void* p)
|
|||||||
/* We pull this out so the tests don't have to rely on a magic constant or
|
/* We pull this out so the tests don't have to rely on a magic constant or
|
||||||
* instantiate the table class template as it can be quite gory.
|
* instantiate the table class template as it can be quite gory.
|
||||||
*/
|
*/
|
||||||
constexpr static float const mlf = 0.875f;
|
BOOST_STATIC_CONSTEXPR float mlf = 0.875f;
|
||||||
|
|
||||||
template<typename TypePolicy,typename Hash,typename Pred,typename Allocator>
|
template<typename TypePolicy,typename Hash,typename Pred,typename Allocator>
|
||||||
class
|
class
|
||||||
@ -1065,7 +1071,7 @@ table:empty_value<Hash,0>,empty_value<Pred,1>,empty_value<Allocator,2>
|
|||||||
using allocator_base=empty_value<Allocator,2>;
|
using allocator_base=empty_value<Allocator,2>;
|
||||||
using type_policy=TypePolicy;
|
using type_policy=TypePolicy;
|
||||||
using group_type=group15;
|
using group_type=group15;
|
||||||
static constexpr auto N=group_type::N;
|
BOOST_STATIC_CONSTEXPR auto N=group_type::N;
|
||||||
using size_policy=pow2_size_policy;
|
using size_policy=pow2_size_policy;
|
||||||
using prober=pow2_quadratic_prober;
|
using prober=pow2_quadratic_prober;
|
||||||
using mix_policy=typename std::conditional<
|
using mix_policy=typename std::conditional<
|
||||||
@ -1081,7 +1087,7 @@ public:
|
|||||||
using value_type=typename type_policy::value_type;
|
using value_type=typename type_policy::value_type;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr bool has_mutable_iterator=
|
BOOST_STATIC_CONSTEXPR bool has_mutable_iterator=
|
||||||
!std::is_same<key_type,value_type>::value;
|
!std::is_same<key_type,value_type>::value;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -1112,7 +1118,7 @@ public:
|
|||||||
table{x,alloc_traits::select_on_container_copy_construction(x.al())}{}
|
table{x,alloc_traits::select_on_container_copy_construction(x.al())}{}
|
||||||
|
|
||||||
table(table&& x)
|
table(table&& x)
|
||||||
noexcept(
|
BOOST_NOEXCEPT_IF(
|
||||||
std::is_nothrow_move_constructible<Hash>::value&&
|
std::is_nothrow_move_constructible<Hash>::value&&
|
||||||
std::is_nothrow_move_constructible<Pred>::value&&
|
std::is_nothrow_move_constructible<Pred>::value&&
|
||||||
std::is_nothrow_move_constructible<Allocator>::value):
|
std::is_nothrow_move_constructible<Allocator>::value):
|
||||||
@ -1156,9 +1162,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~table()noexcept
|
~table()BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
for_all_elements([this](value_type* p){
|
for_all_elements([this](group_type*,unsigned int,value_type* p){
|
||||||
destroy_element(p);
|
destroy_element(p);
|
||||||
});
|
});
|
||||||
delete_arrays(arrays);
|
delete_arrays(arrays);
|
||||||
@ -1192,19 +1198,19 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
table& operator=(table&& x)
|
table& operator=(table&& x)
|
||||||
noexcept(
|
BOOST_NOEXCEPT_IF(
|
||||||
alloc_traits::is_always_equal::value&&
|
alloc_traits::is_always_equal::value&&
|
||||||
std::is_nothrow_move_assignable<Hash>::value&&
|
std::is_nothrow_move_assignable<Hash>::value&&
|
||||||
std::is_nothrow_move_assignable<Pred>::value)
|
std::is_nothrow_move_assignable<Pred>::value)
|
||||||
{
|
{
|
||||||
static constexpr auto pocma=
|
BOOST_STATIC_CONSTEXPR auto pocma=
|
||||||
alloc_traits::propagate_on_container_move_assignment::value;
|
alloc_traits::propagate_on_container_move_assignment::value;
|
||||||
|
|
||||||
if(this!=std::addressof(x)){
|
if(this!=std::addressof(x)){
|
||||||
clear();
|
clear();
|
||||||
h()=std::move(x.h());
|
h()=std::move(x.h());
|
||||||
pred()=std::move(x.pred());
|
pred()=std::move(x.pred());
|
||||||
if(pocma||al()==x.al()){
|
if_constexpr(pocma||al()==x.al()){
|
||||||
using std::swap;
|
using std::swap;
|
||||||
reserve(0);
|
reserve(0);
|
||||||
move_assign_if<pocma>(al(),x.al());
|
move_assign_if<pocma>(al(),x.al());
|
||||||
@ -1233,25 +1239,25 @@ public:
|
|||||||
#pragma warning(pop) /* C4127 */
|
#pragma warning(pop) /* C4127 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
allocator_type get_allocator()const noexcept{return al();}
|
allocator_type get_allocator()const BOOST_NOEXCEPT{return al();}
|
||||||
|
|
||||||
iterator begin()noexcept
|
iterator begin()BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
iterator it{arrays.groups,0,arrays.elements};
|
iterator it{arrays.groups,0,arrays.elements};
|
||||||
if(!(arrays.groups[0].match_occupied()&0x1))++it;
|
if(!(arrays.groups[0].match_occupied()&0x1))++it;
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator begin()const noexcept
|
const_iterator begin()const BOOST_NOEXCEPT
|
||||||
{return const_cast<table*>(this)->begin();}
|
{return const_cast<table*>(this)->begin();}
|
||||||
iterator end()noexcept{return {};}
|
iterator end()BOOST_NOEXCEPT{return {};}
|
||||||
const_iterator end()const noexcept{return const_cast<table*>(this)->end();}
|
const_iterator end()const BOOST_NOEXCEPT{return const_cast<table*>(this)->end();}
|
||||||
const_iterator cbegin()const noexcept{return begin();}
|
const_iterator cbegin()const BOOST_NOEXCEPT{return begin();}
|
||||||
const_iterator cend()const noexcept{return end();}
|
const_iterator cend()const BOOST_NOEXCEPT{return end();}
|
||||||
|
|
||||||
bool empty()const noexcept{return size()==0;}
|
bool empty()const BOOST_NOEXCEPT{return size()==0;}
|
||||||
std::size_t size()const noexcept{return size_;}
|
std::size_t size()const BOOST_NOEXCEPT{return size_;}
|
||||||
std::size_t max_size()const noexcept{return SIZE_MAX;}
|
std::size_t max_size()const BOOST_NOEXCEPT{return SIZE_MAX;}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
BOOST_FORCEINLINE std::pair<iterator,bool> emplace(Args&&... args)
|
BOOST_FORCEINLINE std::pair<iterator,bool> emplace(Args&&... args)
|
||||||
@ -1297,9 +1303,9 @@ public:
|
|||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
has_mutable_iterator||dependent_value>::type* =nullptr
|
has_mutable_iterator||dependent_value>::type* =nullptr
|
||||||
>
|
>
|
||||||
void erase(iterator pos)noexcept{return erase(const_iterator(pos));}
|
void erase(iterator pos)BOOST_NOEXCEPT{return erase(const_iterator(pos));}
|
||||||
|
|
||||||
void erase(const_iterator pos)noexcept
|
void erase(const_iterator pos)BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
destroy_element(pos.p);
|
destroy_element(pos.p);
|
||||||
group_type::reset(pos.pc);
|
group_type::reset(pos.pc);
|
||||||
@ -1320,12 +1326,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void swap(table& x)
|
void swap(table& x)
|
||||||
noexcept(
|
BOOST_NOEXCEPT_IF(
|
||||||
alloc_traits::is_always_equal::value&&
|
alloc_traits::is_always_equal::value&&
|
||||||
boost::is_nothrow_swappable<Hash>::value&&
|
boost::is_nothrow_swappable<Hash>::value&&
|
||||||
boost::is_nothrow_swappable<Pred>::value)
|
boost::is_nothrow_swappable<Pred>::value)
|
||||||
{
|
{
|
||||||
static constexpr auto pocs=
|
BOOST_STATIC_CONSTEXPR auto pocs=
|
||||||
alloc_traits::propagate_on_container_swap::value;
|
alloc_traits::propagate_on_container_swap::value;
|
||||||
|
|
||||||
using std::swap;
|
using std::swap;
|
||||||
@ -1343,7 +1349,7 @@ public:
|
|||||||
swap(ml,x.ml);
|
swap(ml,x.ml);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()noexcept
|
void clear()BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
auto p=arrays.elements;
|
auto p=arrays.elements;
|
||||||
if(p){
|
if(p){
|
||||||
@ -1392,18 +1398,18 @@ public:
|
|||||||
return const_cast<table*>(this)->find(x);
|
return const_cast<table*>(this)->find(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t capacity()const noexcept
|
std::size_t capacity()const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return arrays.elements?(arrays.groups_size_mask+1)*N-1:0;
|
return arrays.elements?(arrays.groups_size_mask+1)*N-1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float load_factor()const noexcept
|
float load_factor()const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (capacity() == 0) { return 0; }
|
if (capacity() == 0) { return 0; }
|
||||||
return float(size())/float(capacity());
|
return float(size())/float(capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
float max_load_factor()const noexcept{return mlf;}
|
float max_load_factor()const BOOST_NOEXCEPT{return mlf;}
|
||||||
|
|
||||||
void rehash(std::size_t n)
|
void rehash(std::size_t n)
|
||||||
{
|
{
|
||||||
@ -1431,7 +1437,14 @@ private:
|
|||||||
|
|
||||||
struct clear_on_exit
|
struct clear_on_exit
|
||||||
{
|
{
|
||||||
|
clear_on_exit(table& x_) : x(x_) {}
|
||||||
~clear_on_exit(){x.clear();}
|
~clear_on_exit(){x.clear();}
|
||||||
|
|
||||||
|
clear_on_exit&
|
||||||
|
operator=(clear_on_exit const&) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
table& x;
|
table& x;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1447,7 +1460,7 @@ private:
|
|||||||
return arrays_type::new_(al(),n);
|
return arrays_type::new_(al(),n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_arrays(arrays_type& arrays_)noexcept
|
void delete_arrays(arrays_type& arrays_)BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
arrays_type::delete_(al(),arrays_);
|
arrays_type::delete_(al(),arrays_);
|
||||||
}
|
}
|
||||||
@ -1458,7 +1471,7 @@ private:
|
|||||||
alloc_traits::construct(al(),p,std::forward<Args>(args)...);
|
alloc_traits::construct(al(),p,std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy_element(value_type* p)noexcept
|
void destroy_element(value_type* p)BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
alloc_traits::destroy(al(),p);
|
alloc_traits::destroy(al(),p);
|
||||||
}
|
}
|
||||||
@ -1472,7 +1485,7 @@ private:
|
|||||||
|
|
||||||
std::size_t max_load()const
|
std::size_t max_load()const
|
||||||
{
|
{
|
||||||
static constexpr std::size_t small_capacity=2*N-1;
|
BOOST_STATIC_CONSTEXPR std::size_t small_capacity=2*N-1;
|
||||||
|
|
||||||
auto capacity_=capacity();
|
auto capacity_=capacity();
|
||||||
if(capacity_<=small_capacity){
|
if(capacity_<=small_capacity){
|
||||||
@ -1629,7 +1642,7 @@ private:
|
|||||||
{
|
{
|
||||||
std::size_t num_destroyed=0;
|
std::size_t num_destroyed=0;
|
||||||
BOOST_TRY{
|
BOOST_TRY{
|
||||||
for_all_elements([&,this](value_type* p){
|
for_all_elements([&,this](group_type*,unsigned int,value_type* p){
|
||||||
nosize_transfer_element(p,new_arrays_,num_destroyed);
|
nosize_transfer_element(p,new_arrays_,num_destroyed);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1647,7 +1660,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue_:
|
continue_:
|
||||||
for_all_elements(new_arrays_,[this](value_type* p){
|
for_all_elements(new_arrays_,[this](group_type*,unsigned int,value_type* p){
|
||||||
destroy_element(p);
|
destroy_element(p);
|
||||||
});
|
});
|
||||||
delete_arrays(new_arrays_);
|
delete_arrays(new_arrays_);
|
||||||
@ -1658,7 +1671,7 @@ private:
|
|||||||
/* either all moved and destroyed or all copied */
|
/* either all moved and destroyed or all copied */
|
||||||
BOOST_ASSERT(num_destroyed==size()||num_destroyed==0);
|
BOOST_ASSERT(num_destroyed==size()||num_destroyed==0);
|
||||||
if(num_destroyed!=size()){
|
if(num_destroyed!=size()){
|
||||||
for_all_elements([this](value_type* p){
|
for_all_elements([this](group_type*,unsigned int,value_type* p){
|
||||||
destroy_element(p);
|
destroy_element(p);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1804,13 +1817,13 @@ private:
|
|||||||
for_all_elements(arrays,f);
|
for_all_elements(arrays,f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename F>
|
// template<typename F>
|
||||||
static auto for_all_elements(const arrays_type& arrays_,F f)
|
// static auto for_all_elements(const arrays_type& arrays_,F f)
|
||||||
->decltype(f(nullptr),void())
|
// ->decltype(f(nullptr),void())
|
||||||
{
|
// {
|
||||||
for_all_elements(
|
// for_all_elements(
|
||||||
arrays_,[&](group_type*,unsigned int,value_type* p){return f(p);});
|
// arrays_,[&](group_type*,unsigned int,value_type* p){return f(p);});
|
||||||
}
|
// }
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
static auto for_all_elements(const arrays_type& arrays_,F f)
|
static auto for_all_elements(const arrays_type& arrays_,F f)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#define BOOST_UNORDERED_DETAIL_XMX_HPP
|
#define BOOST_UNORDERED_DETAIL_XMX_HPP
|
||||||
|
|
||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ namespace detail{
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline std::size_t xmx(std::size_t x)noexcept
|
static inline std::size_t xmx(std::size_t x)BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
#if defined(BOOST_UNORDERED_64B_ARCHITECTURE)
|
#if defined(BOOST_UNORDERED_64B_ARCHITECTURE)
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unordered_flat_map(unordered_flat_map&& other)
|
unordered_flat_map(unordered_flat_map&& other)
|
||||||
noexcept(std::is_nothrow_move_constructible<hasher>::value&&
|
BOOST_NOEXCEPT_IF(std::is_nothrow_move_constructible<hasher>::value&&
|
||||||
std::is_nothrow_move_constructible<key_equal>::value&&
|
std::is_nothrow_move_constructible<key_equal>::value&&
|
||||||
std::is_nothrow_move_constructible<allocator_type>::value)
|
std::is_nothrow_move_constructible<allocator_type>::value)
|
||||||
: table_(std::move(other.table_))
|
: table_(std::move(other.table_))
|
||||||
@ -176,14 +176,14 @@ namespace boost {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
unordered_flat_map& operator=(unordered_flat_map&& other) noexcept(
|
unordered_flat_map& operator=(unordered_flat_map&& other) BOOST_NOEXCEPT_IF(
|
||||||
noexcept(std::declval<table_type&>() = std::declval<table_type&&>()))
|
BOOST_NOEXCEPT_EXPR(std::declval<table_type&>() = std::declval<table_type&&>()))
|
||||||
{
|
{
|
||||||
table_ = std::move(other.table_);
|
table_ = std::move(other.table_);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocator_type get_allocator() const noexcept
|
allocator_type get_allocator() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return table_.get_allocator();
|
return table_.get_allocator();
|
||||||
}
|
}
|
||||||
@ -191,30 +191,30 @@ namespace boost {
|
|||||||
/// Iterators
|
/// Iterators
|
||||||
///
|
///
|
||||||
|
|
||||||
iterator begin() noexcept { return table_.begin(); }
|
iterator begin() BOOST_NOEXCEPT { return table_.begin(); }
|
||||||
const_iterator begin() const noexcept { return table_.begin(); }
|
const_iterator begin() const BOOST_NOEXCEPT { return table_.begin(); }
|
||||||
const_iterator cbegin() const noexcept { return table_.cbegin(); }
|
const_iterator cbegin() const BOOST_NOEXCEPT { return table_.cbegin(); }
|
||||||
|
|
||||||
iterator end() noexcept { return table_.end(); }
|
iterator end() BOOST_NOEXCEPT { return table_.end(); }
|
||||||
const_iterator end() const noexcept { return table_.end(); }
|
const_iterator end() const BOOST_NOEXCEPT { return table_.end(); }
|
||||||
const_iterator cend() const noexcept { return table_.cend(); }
|
const_iterator cend() const BOOST_NOEXCEPT { return table_.cend(); }
|
||||||
|
|
||||||
/// Capacity
|
/// Capacity
|
||||||
///
|
///
|
||||||
|
|
||||||
BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
|
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return table_.empty();
|
return table_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type size() const noexcept { return table_.size(); }
|
size_type size() const BOOST_NOEXCEPT { return table_.size(); }
|
||||||
|
|
||||||
size_type max_size() const noexcept { return table_.max_size(); }
|
size_type max_size() const BOOST_NOEXCEPT { return table_.max_size(); }
|
||||||
|
|
||||||
/// Modifiers
|
/// Modifiers
|
||||||
///
|
///
|
||||||
|
|
||||||
void clear() noexcept { table_.clear(); }
|
void clear() BOOST_NOEXCEPT { table_.clear(); }
|
||||||
|
|
||||||
template <class Ty>
|
template <class Ty>
|
||||||
auto insert(Ty&& value)
|
auto insert(Ty&& value)
|
||||||
@ -344,8 +344,8 @@ namespace boost {
|
|||||||
return table_.erase(key);
|
return table_.erase(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(unordered_flat_map& rhs) noexcept(
|
void swap(unordered_flat_map& rhs) BOOST_NOEXCEPT_IF(
|
||||||
noexcept(std::declval<table_type&>().swap(std::declval<table_type&>())))
|
BOOST_NOEXCEPT_EXPR(std::declval<table_type&>().swap(std::declval<table_type&>())))
|
||||||
{
|
{
|
||||||
table_.swap(rhs.table_);
|
table_.swap(rhs.table_);
|
||||||
}
|
}
|
||||||
@ -519,11 +519,11 @@ namespace boost {
|
|||||||
/// Hash Policy
|
/// Hash Policy
|
||||||
///
|
///
|
||||||
|
|
||||||
size_type bucket_count() const noexcept { return table_.capacity(); }
|
size_type bucket_count() const BOOST_NOEXCEPT { return table_.capacity(); }
|
||||||
|
|
||||||
float load_factor() const noexcept { return table_.load_factor(); }
|
float load_factor() const BOOST_NOEXCEPT { return table_.load_factor(); }
|
||||||
|
|
||||||
float max_load_factor() const noexcept
|
float max_load_factor() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return table_.max_load_factor();
|
return table_.max_load_factor();
|
||||||
}
|
}
|
||||||
@ -573,7 +573,7 @@ namespace boost {
|
|||||||
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
|
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
|
||||||
void swap(unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& lhs,
|
void swap(unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& lhs,
|
||||||
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& rhs)
|
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& rhs)
|
||||||
noexcept(noexcept(lhs.swap(rhs)))
|
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace boost {
|
|||||||
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
|
template <class Key, class T, class Hash, class KeyEqual, class Allocator>
|
||||||
void swap(unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& lhs,
|
void swap(unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& lhs,
|
||||||
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& rhs)
|
unordered_flat_map<Key, T, Hash, KeyEqual, Allocator>& rhs)
|
||||||
noexcept(noexcept(lhs.swap(rhs)));
|
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(lhs.swap(rhs)));
|
||||||
} // namespace unordered
|
} // namespace unordered
|
||||||
|
|
||||||
using boost::unordered::unordered_flat_map;
|
using boost::unordered::unordered_flat_map;
|
||||||
|
@ -118,7 +118,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unordered_flat_set(unordered_flat_set&& other)
|
unordered_flat_set(unordered_flat_set&& other)
|
||||||
noexcept(std::is_nothrow_move_constructible<hasher>::value&&
|
BOOST_NOEXCEPT_IF(std::is_nothrow_move_constructible<hasher>::value&&
|
||||||
std::is_nothrow_move_constructible<key_equal>::value&&
|
std::is_nothrow_move_constructible<key_equal>::value&&
|
||||||
std::is_nothrow_move_constructible<allocator_type>::value)
|
std::is_nothrow_move_constructible<allocator_type>::value)
|
||||||
: table_(std::move(other.table_))
|
: table_(std::move(other.table_))
|
||||||
@ -158,14 +158,14 @@ namespace boost {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
unordered_flat_set& operator=(unordered_flat_set&& other) noexcept(
|
unordered_flat_set& operator=(unordered_flat_set&& other) BOOST_NOEXCEPT_IF(
|
||||||
noexcept(std::declval<table_type&>() = std::declval<table_type&&>()))
|
BOOST_NOEXCEPT_EXPR(std::declval<table_type&>() = std::declval<table_type&&>()))
|
||||||
{
|
{
|
||||||
table_ = std::move(other.table_);
|
table_ = std::move(other.table_);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocator_type get_allocator() const noexcept
|
allocator_type get_allocator() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return table_.get_allocator();
|
return table_.get_allocator();
|
||||||
}
|
}
|
||||||
@ -173,30 +173,30 @@ namespace boost {
|
|||||||
/// Iterators
|
/// Iterators
|
||||||
///
|
///
|
||||||
|
|
||||||
iterator begin() noexcept { return table_.begin(); }
|
iterator begin() BOOST_NOEXCEPT { return table_.begin(); }
|
||||||
const_iterator begin() const noexcept { return table_.begin(); }
|
const_iterator begin() const BOOST_NOEXCEPT { return table_.begin(); }
|
||||||
const_iterator cbegin() const noexcept { return table_.cbegin(); }
|
const_iterator cbegin() const BOOST_NOEXCEPT { return table_.cbegin(); }
|
||||||
|
|
||||||
iterator end() noexcept { return table_.end(); }
|
iterator end() BOOST_NOEXCEPT { return table_.end(); }
|
||||||
const_iterator end() const noexcept { return table_.end(); }
|
const_iterator end() const BOOST_NOEXCEPT { return table_.end(); }
|
||||||
const_iterator cend() const noexcept { return table_.cend(); }
|
const_iterator cend() const BOOST_NOEXCEPT { return table_.cend(); }
|
||||||
|
|
||||||
/// Capacity
|
/// Capacity
|
||||||
///
|
///
|
||||||
|
|
||||||
BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept
|
BOOST_ATTRIBUTE_NODISCARD bool empty() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return table_.empty();
|
return table_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type size() const noexcept { return table_.size(); }
|
size_type size() const BOOST_NOEXCEPT { return table_.size(); }
|
||||||
|
|
||||||
size_type max_size() const noexcept { return table_.max_size(); }
|
size_type max_size() const BOOST_NOEXCEPT { return table_.max_size(); }
|
||||||
|
|
||||||
/// Modifiers
|
/// Modifiers
|
||||||
///
|
///
|
||||||
|
|
||||||
void clear() noexcept { table_.clear(); }
|
void clear() BOOST_NOEXCEPT { table_.clear(); }
|
||||||
|
|
||||||
std::pair<iterator, bool> insert(value_type const& value)
|
std::pair<iterator, bool> insert(value_type const& value)
|
||||||
{
|
{
|
||||||
@ -262,8 +262,8 @@ namespace boost {
|
|||||||
return table_.erase(key);
|
return table_.erase(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(unordered_flat_set& rhs) noexcept(
|
void swap(unordered_flat_set& rhs) BOOST_NOEXCEPT_IF(
|
||||||
noexcept(std::declval<table_type&>().swap(std::declval<table_type&>())))
|
BOOST_NOEXCEPT_EXPR(std::declval<table_type&>().swap(std::declval<table_type&>())))
|
||||||
{
|
{
|
||||||
table_.swap(rhs.table_);
|
table_.swap(rhs.table_);
|
||||||
}
|
}
|
||||||
@ -400,11 +400,11 @@ namespace boost {
|
|||||||
/// Hash Policy
|
/// Hash Policy
|
||||||
///
|
///
|
||||||
|
|
||||||
size_type bucket_count() const noexcept { return table_.capacity(); }
|
size_type bucket_count() const BOOST_NOEXCEPT { return table_.capacity(); }
|
||||||
|
|
||||||
float load_factor() const noexcept { return table_.load_factor(); }
|
float load_factor() const BOOST_NOEXCEPT { return table_.load_factor(); }
|
||||||
|
|
||||||
float max_load_factor() const noexcept
|
float max_load_factor() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return table_.max_load_factor();
|
return table_.max_load_factor();
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ namespace boost {
|
|||||||
template <class Key, class Hash, class KeyEqual, class Allocator>
|
template <class Key, class Hash, class KeyEqual, class Allocator>
|
||||||
void swap(unordered_flat_set<Key, Hash, KeyEqual, Allocator>& lhs,
|
void swap(unordered_flat_set<Key, Hash, KeyEqual, Allocator>& lhs,
|
||||||
unordered_flat_set<Key, Hash, KeyEqual, Allocator>& rhs)
|
unordered_flat_set<Key, Hash, KeyEqual, Allocator>& rhs)
|
||||||
noexcept(noexcept(lhs.swap(rhs)))
|
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace boost {
|
|||||||
template <class Key, class Hash, class KeyEqual, class Allocator>
|
template <class Key, class Hash, class KeyEqual, class Allocator>
|
||||||
void swap(unordered_flat_set<Key, Hash, KeyEqual, Allocator>& lhs,
|
void swap(unordered_flat_set<Key, Hash, KeyEqual, Allocator>& lhs,
|
||||||
unordered_flat_set<Key, Hash, KeyEqual, Allocator>& rhs)
|
unordered_flat_set<Key, Hash, KeyEqual, Allocator>& rhs)
|
||||||
noexcept(noexcept(lhs.swap(rhs)));
|
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(lhs.swap(rhs)));
|
||||||
} // namespace unordered
|
} // namespace unordered
|
||||||
|
|
||||||
using boost::unordered::unordered_flat_set;
|
using boost::unordered::unordered_flat_set;
|
||||||
|
Reference in New Issue
Block a user