예제 #1
0
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
0
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
0
 trie_set(Iter first, Iter last,
     const BitComp &bit_comp = BitComp(),
     const Allocator &alloc = Allocator())
     : super(bit_comp, alloc)
 {
     insert(first, last);
 }
예제 #4
0
파일: list.cpp 프로젝트: pshizhsysu/STL
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
0
 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
0
 huge_forward_hash_map (std::initializer_list <value_type> initializer,
                        std::size_t      num_buckets = 0,
                        const Hash&      hash        = Hash (),
                        const Equal&     equal       = Equal (),
                        const Allocator& allocator   = Allocator ())
   : table_type (initializer, num_buckets, hash, equal, allocator)
 { }
예제 #7
0
 explicit
 huge_forward_hash_map (size_t           num_buckets = 0,
                        const Hash&      hash        = Hash (),
                        const Equal&     equal       = Equal (),
                        const Allocator& allocator   = Allocator ())
   : table_type (num_buckets, hash, equal, allocator)
 { }
 WorkItem terminate_processor( const processor_handle & processor )
 {
   return WorkItem(
     bind( &processor_container::terminate_processor_impl, this,
       processor ),
     Allocator() );
 }
예제 #9
0
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();
}
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
예제 #11
0
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
예제 #12
0
	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);
	}
예제 #13
0
파일: main.cpp 프로젝트: jreese/rit
int main( int argc, char* argv[] ) {
	srand( time( NULL ) );

	Allocator a = Allocator( POOLSIZE, NCLIENTS );
	a.start();

	a.join();
}
예제 #14
0
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
예제 #15
0
 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 );
 }
예제 #16
0
	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) {}
예제 #17
0
 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;
   }
 }
예제 #18
0
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
}
    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() );
    }
예제 #20
0
파일: list.cpp 프로젝트: pshizhsysu/STL
void List<T, Allocator>::destroy(iterator first, iterator last)  
{  
    if(first == last)  
        return;  
    iterator it;  
    for(it = first; it != last; ++it)  
    {  
        Allocator().destroy(&*it);  
    }     
}  
예제 #21
0
void dng_host::PerformAreaTask (dng_area_task &task,
								const dng_rect &area)
	{
	
	dng_area_task::Perform (task,
							area,
							&Allocator (),
							Sniffer ());
	
	}
예제 #22
0
		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);
			}
		}
예제 #23
0
 /**
  * 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);
 }
예제 #24
0
void AbstractTarget::Build(void)
{
	Sizer();
	Descriptor();
	Allocator();
	Vector();
	VectorX();
	Printer();
	ShiftDipolesAndX();
	PrepareIaniso();
	PreparePyzd();
}
예제 #25
0
void 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
}
예제 #26
0
void
test3(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
}
 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() );
 }
예제 #28
0
    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));
    }
dng_xmp * dng_host::Make_dng_xmp ()
	{
		
	dng_xmp *result = new dng_xmp (Allocator ());
	
	if (!result)
		{
		
		ThrowMemoryFull ();
		
		}
	
	return result;
	
	}
예제 #30
0
 dynamic_bitset(BlockInputIterator first, BlockInputIterator last,
            const Allocator& alloc = Allocator())
     : detail::dynamic_bitset_base<Block, Allocator>
         (detail::initial_num_blocks(first, last)
         * bits_per_block, alloc)
 {
     if (first != last) {
         if (this->m_num_bits == 0) { // dealing with input iterators
             this->append(first, last);
         } else {
             // dealing with forward iterators, memory has been allocated
             for (std::size_t i = 0; first != last; ++first, ++i)
                 set_block_(i, *first);
         }
     }
 }