本文整理汇总了C++中static_hashed_set::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ static_hashed_set::insert方法的具体用法?C++ static_hashed_set::insert怎么用?C++ static_hashed_set::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static_hashed_set
的用法示例。
在下文中一共展示了static_hashed_set::insert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_items
void add_items(void)
{
for (long i = 0; i != node_count; ++i)
{
long id = generate_id<long>();
bool inserted = data.insert(id);
assert(inserted);
while(stk.push(id) == false)
thread::yield();
++push_count;
}
}
示例2: allocate
void allocate(void)
{
for (long i = 0; i != operations_per_thread; ++i) {
for (;;) {
dummy * node = fl.template construct<true, bounded>();
if (node) {
bool success = working_set.insert(node);
assert(success);
allocated_nodes.push(node);
break;
}
}
}
}
示例3: add_items
void add_items(void)
{
unsigned long count = 1000000;
for (long i = 0; i != count; ++i)
{
thread::yield();
long id = generate_id<long>();
bool inserted = data.insert(id);
assert(inserted);
stk.push(id);
}
}
示例4: get_items
void get_items(queue & stk)
{
for (;;) {
long id;
bool got = stk.pop(id);
if (got) {
bool erased = data.erase(id);
bool inserted = dequeued.insert(id);
assert(erased);
assert(inserted);
++pop_count;
} else
if (!running.load())
return;
}
}
示例5: add_items
void add_items(queue & stk)
{
for (long i = 0; i != node_count; ++i) {
long id = generate_id<long>();
bool inserted = data.insert(id);
assert(inserted);
if (Bounded)
while(stk.bounded_push(id) == false)
/*thread::yield()*/;
else
while(stk.push(id) == false)
/*thread::yield()*/;
++push_count;
}
}
示例6: add
void add(void)
{
for (unsigned i = 0; i != nodes_per_thread; ++i)
{
while(fifo_cnt > 10000)
thread::yield();
int id = generate_id<int>();
working_set.insert(id);
while (sf.enqueue(id) == false)
{
thread::yield();
}
++fifo_cnt;
}
}
示例7: add
void add(void)
{
boost::array<int, buf_size> input_buffer;
for (boost::uint32_t i = 0; i != nodes_per_thread; i+=buf_size) {
for (size_t i = 0; i != buf_size; ++i) {
int id = generate_id<int>();
working_set.insert(id);
input_buffer[i] = id;
}
size_t pushed = 0;
do {
pushed += sf.push(input_buffer.c_array() + pushed,
input_buffer.size() - pushed);
} while (pushed != buf_size);
spsc_queue_cnt+=buf_size;
}
}