當前位置: 首頁>>代碼示例>>C++>>正文


C++ Allocator函數代碼示例

本文整理匯總了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
開發者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


注:本文中的Allocator函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。