本文整理汇总了C++中Allocator函数的典型用法代码示例。如果您正苦于以下问题:C++ Allocator函数的具体用法?C++ Allocator怎么用?C++ Allocator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Allocator函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ctor
void ctor() {
choosing = Allocator( sizeof(typeof(choosing[0])) * N );
ticket = Allocator( sizeof(typeof(ticket[0])) * N );
for ( int i = 0; i < N; i += 1 ) { // initialize shared data
choosing[i] = ticket[i] = 0;
} // for
} // ctor
示例2: ctor
void ctor() {
c = Allocator( sizeof(typeof(c[0])) * N );
v = Allocator( sizeof(typeof(v[0])) * N );
intents = Allocator( sizeof(typeof(intents[0])) * N );
turn = Allocator( sizeof(typeof(turn[0])) * N );
for ( int i = 0; i < N; i += 1 ) {
c[i] = v[i] = intents[i] = turn[i] = 0;
} // for
} // ctor
示例3: trie_set
trie_set(Iter first, Iter last,
const BitComp &bit_comp = BitComp(),
const Allocator &alloc = Allocator())
: super(bit_comp, alloc)
{
insert(first, last);
}
示例4: Allocator
void List<T, Allocator>::erase(iterator pos)
{
Allocator().destroy(&*pos);
pos.ptr -> pre -> next = pos.ptr -> next;
pos.ptr -> next -> pre = pos.ptr -> pre;
node_allocator_type().deallocate(pos.ptr, 1);
}
示例5: huge_forward_hash_map
huge_forward_hash_map (InputIterator first, InputIterator last,
size_t num_buckets = 0,
const Hash& hash = Hash (),
const Equal& equal = Equal (),
const Allocator& allocator = Allocator ())
: table_type (first, last, num_buckets, hash, equal, allocator)
{ }
示例6: terminate_processor
WorkItem terminate_processor( const processor_handle & processor )
{
return WorkItem(
bind( &processor_container::terminate_processor_impl, this,
processor ),
Allocator() );
}
示例7: while
TStack::TStack(const std::string fileName)
{
fin.open(fileName, std::ios::binary|std::ios::in);
if (!fin.is_open()) {
return;
}
fin.seekg(0, fin.end);
size_t len = fin.tellg();
fin.seekg(0, fin.beg);
Buffer.resize(len);
fin.read((char*)(&Buffer[0]), len);
while (Allocator()) {
}
stdFuncMap.insert(std::make_pair("+", &plus));
stdFuncMap.insert(std::make_pair("-", &minus));
stdFuncMap.insert(std::make_pair("/", &division));
stdFuncMap.insert(std::make_pair("*", &mult));
stdFuncMap.insert(std::make_pair("cons", &cons));
stdFuncMap.insert(std::make_pair("append", &append));
stdFuncMap.insert(std::make_pair("list", &list));
stdFuncMap.insert(std::make_pair("=", &equally));
stdFuncMap.insert(std::make_pair("define", &defineFun));
DoCode();
PrintResult();
}
示例8: ctor
void ctor() {
states = Allocator( sizeof(__typeof__(states[0])) * N * PADRATIO);
for ( int i = 0; i < N; i += 1 ) { // initialize shared data
states[i*PADRATIO] = ATOMIC_VAR_INIT(UNLOCKED);
} // for
turn = ATOMIC_VAR_INIT(0);
} // ctor
示例9: ctor
void ctor() {
control = Allocator( sizeof(typeof(control[0])) * N );
for ( int i = 0; i < N; i += 1 ) { // initialize shared data
control[i] = DontWantIn;
} // for
HIGH = 0;
} // ctor
示例10: SortedSyncPtrVector
SortedSyncPtrVector(bool del, size_t initial = 64, const Allocator &alloc = Allocator())
: _data(alloc)
, _delete_data(del)
{
_data.reserve(initial);
assert(sem_init(&_count, 0, 0) == 0);
}
示例11: main
int main( int argc, char* argv[] ) {
srand( time( NULL ) );
Allocator a = Allocator( POOLSIZE, NCLIENTS );
a.start();
a.join();
}
示例12: ctor
void ctor() {
depth = Clog2( N ); // maximal depth of binary tree
int width = 1 << depth; // maximal width of binary tree
t = Allocator( sizeof(typeof(t[0])) * depth ); // allocate matrix columns
for ( int r = 0; r < depth; r += 1 ) { // allocate matrix rows
int size = width >> r; // maximal row size
t[r] = Allocator( sizeof(typeof(t[0][0])) * size );
for ( int c = 0; c < size; c += 1 ) { // initial all intents to dont-want-in
t[r][c].Q[0] = t[r][c].Q[1] = 0;
#if defined( KESSELS2 )
t[r][c].R[0] = t[r][c].R[1] = 0;
#else
t[r][c].R = 0;
#endif // KESSELS2
} // for
} // for
} // ctor
示例13: ptr_set_adapter
ptr_set_adapter( InputIterator first, InputIterator last,
const Compare& comp = Compare(),
const Allocator a = Allocator() )
: base_type( comp, a )
{
BOOST_ASSERT( this->empty() );
set_basic_clone_and_insert( first, last );
}
示例14: unordered_multimap
unordered_multimap(
InputIt first,
InputIt last,
size_type bucket_count = unordered_map_default_bucket_count,
const Hash& hash = Hash(),
const KeyEqual& equal = KeyEqual(),
const Allocator& alloc = Allocator())
: _Base(first, last, bucket_count, hash, equal, alloc) {}
示例15: _regs
Allocator::Allocator(const SpillPolicy::RegisterId regs, const policy_t spillPolicies,
const PolicyWeightMap &weights) : _regs(regs), _newSpill(false)
{
Allocator(regs, spillPolicies);
for(PolicyWeightMap::const_iterator a = weights.begin(); a != weights.end(); a++)
{
_weights[a->first] = a->second;
}
}