本文整理汇总了C++中Allocator函数的典型用法代码示例。如果您正苦于以下问题:C++ Allocator函数的具体用法?C++ Allocator怎么用?C++ Allocator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Allocator函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:pramalhe,项目名称:concurrent-locking,代码行数:7,代码来源:LamportBakery.c
示例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
开发者ID:pramalhe,项目名称:concurrent-locking,代码行数:9,代码来源:LycklamaBuhr.c
示例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);
}
开发者ID:aghandoura,项目名称:patl,代码行数:7,代码来源:trie_set.hpp
示例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);
}
开发者ID:pshizhsysu,项目名称:STL,代码行数:7,代码来源:list.cpp
示例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)
{ }
开发者ID:kingsfordgroup,项目名称:parana2,代码行数:7,代码来源:hash-map.hpp
示例6: terminate_processor
WorkItem terminate_processor( const processor_handle & processor )
{
return WorkItem(
bind( &processor_container::terminate_processor_impl, this,
processor ),
Allocator() );
}
开发者ID:BioinformaticsArchive,项目名称:MulRFRepo,代码行数:7,代码来源:processor_container.hpp
示例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();
}
开发者ID:Roninsc2,项目名称:byte_code_for_scheme,代码行数:25,代码来源:stack.cpp
示例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
开发者ID:bowlofstew,项目名称:ConcurrencyFreaks,代码行数:7,代码来源:CorreiaRamalheteTurnC11.c
示例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
开发者ID:pabuhr,项目名称:concurrent-locking,代码行数:7,代码来源:Eisenberg.c
示例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);
}
开发者ID:wheeland,项目名称:pgasus,代码行数:7,代码来源:synced_containers.hpp
示例11: main
int main( int argc, char* argv[] ) {
srand( time( NULL ) );
Allocator a = Allocator( POOLSIZE, NCLIENTS );
a.start();
a.join();
}
开发者ID:jreese,项目名称:rit,代码行数:8,代码来源:main.cpp
示例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
开发者ID:pramalhe,项目名称:concurrent-locking,代码行数:17,代码来源:TaubenfeldBuhr.c
示例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 );
}
开发者ID:rogerclark,项目名称:grumble,代码行数:8,代码来源:ptr_set_adapter.hpp
示例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) {}
开发者ID:zapster,项目名称:cacao-travis,代码行数:8,代码来源:unordered_map.hpp
示例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;
}
}
开发者ID:dougct,项目名称:ocelot-ufmg,代码行数:9,代码来源:Allocator.cpp
示例16: check_allocator
void check_allocator(unsigned n, Allocator const &alloc = Allocator())
{
#if _LIBCPP_STD_VER > 11
typedef std::forward_list<T, Allocator> C;
C d(n, alloc);
assert(d.get_allocator() == alloc);
assert(std::distance(d.begin(), d.end()) == n);
#endif
}
开发者ID:32bitmicro,项目名称:riscv-libcxx,代码行数:9,代码来源:size.pass.cpp
示例17: queue_event
WorkItem queue_event(
const processor_handle & processor, const event_ptr_type & pEvent )
{
BOOST_ASSERT( pEvent.get() != 0 );
return WorkItem(
bind( &processor_container::queue_event_impl, this, processor,
pEvent ),
Allocator() );
}
开发者ID:BioinformaticsArchive,项目名称:MulRFRepo,代码行数:10,代码来源:processor_container.hpp
示例18: PerformAreaTask
void dng_host::PerformAreaTask (dng_area_task &task,
const dng_rect &area)
{
dng_area_task::Perform (task,
area,
&Allocator (),
Sniffer ());
}
开发者ID:F0x06,项目名称:Movie2DNG,代码行数:10,代码来源:dng_host.cpp
示例19: ArrayList
ArrayList(size_type count, const T& value, const Allocator& alloc = Allocator()):
Allocator(alloc),
cSize(count),
cMaxSize(count),
storage(Alloc::allocate(*this, count))
{
for(auto begin = this->storage, end = this->storage + count; begin != end; ++begin)
{
Alloc::construct(*this, begin, value);
}
}
开发者ID:TimPhoeniX,项目名称:CTL,代码行数:11,代码来源:ctl_arraylist.hpp
示例20: basic_streambuf
/**
* Constructs a streambuf with the specified maximum size. The initial size
* of the streambuf's input sequence is 0.
*/
explicit basic_streambuf(
std::size_t maximum_size = (std::numeric_limits<std::size_t>::max)(),
const Allocator& allocator = Allocator())
: max_size_(maximum_size),
buffer_(allocator)
{
std::size_t pend = (std::min<std::size_t>)(max_size_, buffer_delta);
buffer_.resize((std::max<std::size_t>)(pend, 1));
setg(&buffer_[0], &buffer_[0], &buffer_[0]);
setp(&buffer_[0], &buffer_[0] + pend);
}
开发者ID:13609594236,项目名称:ph-open,代码行数:15,代码来源:basic_streambuf.hpp
注:本文中的Allocator函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论