这篇教程C++ Allocator函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Allocator函数的典型用法代码示例。如果您正苦于以下问题:C++ Allocator函数的具体用法?C++ Allocator怎么用?C++ Allocator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Allocator函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ctorvoid 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,
示例2: ctorvoid 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,
示例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,
示例4: Allocatorvoid 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,
示例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,
示例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,
示例7: whileTStack::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,
示例8: ctorvoid 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,
示例9: ctorvoid 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,
示例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,
示例11: mainint main( int argc, char* argv[] ) { srand( time( NULL ) ); Allocator a = Allocator( POOLSIZE, NCLIENTS ); a.start(); a.join();}
开发者ID:jreese,项目名称:rit,代码行数:8,
示例12: ctorvoid 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,
示例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,
示例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,
示例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,
示例16: check_allocatorvoid 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,
示例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,
示例18: PerformAreaTaskvoid dng_host::PerformAreaTask (dng_area_task &task, const dng_rect &area) { dng_area_task::Perform (task, area, &Allocator (), Sniffer ()); }
开发者ID:F0x06,项目名称:Movie2DNG,代码行数:10,
示例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,
示例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,
示例21: Sizervoid AbstractTarget::Build(void){ Sizer(); Descriptor(); Allocator(); Vector(); VectorX(); Printer(); ShiftDipolesAndX(); PrepareIaniso(); PreparePyzd();}
开发者ID:jstotero,项目名称:ddscatcpp,代码行数:12,
示例22: check_allocatorvoid check_allocator(unsigned n, Allocator const &alloc = Allocator()){#if TEST_STD_VER > 11 typedef std::forward_list<T, Allocator> C; C d(n, alloc); assert(d.get_allocator() == alloc); assert(static_cast<std::size_t>(std::distance(d.begin(), d.end())) == n);#else ((void)n); ((void)alloc);#endif}
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:12,
示例23: test3voidtest3(unsigned n, Allocator const &alloc = Allocator()){#if _LIBCPP_STD_VER > 11 typedef std::deque<T, Allocator> C; typedef typename C::const_iterator const_iterator; { C d(n, alloc); assert(d.size() == n); assert(d.get_allocator() == alloc); }#endif}
开发者ID:Bhudipta,项目名称:minix,代码行数:13,
示例24: create_processor WorkItem create_processor( processor_handle & handle, Scheduler & scheduler ) { processor_holder_ptr_type pProcessor = make_processor_holder(); handle = pProcessor; typedef void ( processor_container::*impl_fun_ptr )( const processor_holder_ptr_type &, const processor_context & ); impl_fun_ptr pImpl = &processor_container::template create_processor_impl0< Processor >; return WorkItem( bind( pImpl, this, pProcessor, processor_context( scheduler, handle ) ), Allocator() ); }
开发者ID:BioinformaticsArchive,项目名称:MulRFRepo,代码行数:13,
示例25: dynamic_bitset explicit dynamic_bitset(const std::basic_string<CharT, Traits, Alloc>& s, typename std::basic_string<CharT, Traits, Alloc>::size_type pos = 0, typename std::basic_string<CharT, Traits, Alloc>::size_type n = (std::basic_string<CharT, Traits, Alloc>::npos), const Allocator& alloc = Allocator()) : detail::dynamic_bitset_base<Block, Allocator> (std::min(n, s.size() - pos), alloc)#endif { // Locate sub string assert(pos <= s.length()); from_string(s, pos, std::min(n, s.size() - pos)); }
开发者ID:NeoAnomaly,项目名称:xray,代码行数:14,
示例26: dng_xmpdng_xmp * dng_host::Make_dng_xmp () { dng_xmp *result = new dng_xmp (Allocator ()); if (!result) { ThrowMemoryFull (); } return result; }
开发者ID:rcketscientist,项目名称:platform_external_dng_sdk,代码行数:15,
注:本文中的Allocator函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Allocator_calloc函数代码示例 C++ AllocateWorkSpace函数代码示例 |