本文整理汇总了C++中table::node_alloc方法的典型用法代码示例。如果您正苦于以下问题:C++ table::node_alloc方法的具体用法?C++ table::node_alloc怎么用?C++ table::node_alloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table
的用法示例。
在下文中一共展示了table::node_alloc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move_assign
void move_assign(table& x, false_type)
{
if (node_alloc() == x.node_alloc()) {
delete_buckets();
set_hash_functions new_func_this(*this, x);
// No throw from here.
mlf_ = x.mlf_;
max_load_ = x.max_load_;
move_buckets_from(x);
new_func_this.commit();
}
else {
set_hash_functions new_func_this(*this, x);
new_func_this.commit();
mlf_ = x.mlf_;
recalculate_max_load();
if (!size_ && !x.size_) return;
if (x.size_ >= max_load_) {
create_buckets(min_buckets_for_size(x.size_));
}
else {
clear_buckets();
}
static_cast<table_impl*>(this)->move_assign_buckets(x);
}
}
示例2: assign
void assign(table const& x, true_type)
{
if (node_alloc() == x.node_alloc()) {
allocators_.assign(x.allocators_);
assign(x, false_type());
}
else {
set_hash_functions new_func_this(*this, x);
// Delete everything with current allocators before assigning
// the new ones.
delete_buckets();
allocators_.assign(x.allocators_);
// Copy over other data, all no throw.
new_func_this.commit();
mlf_ = x.mlf_;
bucket_count_ = min_buckets_for_size(x.size_);
max_load_ = 0;
// Finally copy the elements.
if (x.size_) {
static_cast<table_impl*>(this)->copy_buckets(x);
}
}
}
示例3: swap_allocators
void swap_allocators(table& other, false_type)
{
boost::unordered::detail::func::ignore_unused_variable_warning(other);
// According to 23.2.1.8, if propagate_on_container_swap is
// false the behaviour is undefined unless the allocators
// are equal.
BOOST_ASSERT(node_alloc() == other.node_alloc());
}
示例4: move_init
void move_init(table& x)
{
if(node_alloc() == x.node_alloc()) {
move_buckets_from(x);
}
else if(x.size_) {
// TODO: Could pick new bucket size?
static_cast<table_impl*>(this)->move_buckets(x);
}
}