/usr/include/stxxl/bits/common
NameSizeModeActions
addressable_queues.h60360644editdlrm
aligned_alloc.h53870644editdlrm
binary_buffer.h200630644editdlrm
cmdline.h234820644editdlrm
condition_variable.h21410644editdlrm
counting_ptr.h164040644editdlrm
error_handling.h77020644editdlrm
exceptions.h20000644editdlrm
exithandler.h14000644editdlrm
external_shared_ptr.h37600644editdlrm
is_sorted.h18180644editdlrm
log.h12650644editdlrm
mutex.h33320644editdlrm
new_alloc.h39010644editdlrm
onoff_switch.h21460644editdlrm
rand.h81910644editdlrm
seed.h8630644editdlrm
semaphore.h24490644editdlrm
settings.h9710644editdlrm
simple_vector.h46390644editdlrm
state.h16870644editdlrm
timer.h46620644editdlrm
tmeta.h29880644editdlrm
tuple.h195530644editdlrm
types.h19230644editdlrm
uint_types.h95720644editdlrm
utils.h83800644editdlrm
Edit: /usr/include/stxxl/bits/common/new_alloc.h (3901B)
/*************************************************************************** * include/stxxl/bits/common/new_alloc.h * * Part of the STXXL. See http://stxxl.sourceforge.net * * Copyright (C) 2002-2006 Roman Dementiev * Copyright (C) 2007, 2008, 2010 Andreas Beckmann * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) **************************************************************************/ #ifndef STXXL_COMMON_NEW_ALLOC_HEADER #define STXXL_COMMON_NEW_ALLOC_HEADER #include #include #include STXXL_BEGIN_NAMESPACE template class new_alloc; template struct new_alloc_rebind; template struct new_alloc_rebind{ typedef new_alloc other; }; template struct new_alloc_rebind { typedef std::allocator other; }; // designed for typed_block (to use with std::vector) template class new_alloc { public: // type definitions typedef Type value_type; typedef Type* pointer; typedef const Type* const_pointer; typedef Type& reference; typedef const Type& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; // rebind allocator to type Rebind, use new_alloc only if Rebind == Type template struct rebind { typedef typename new_alloc_rebind::other other; }; // return address of values pointer address(reference value) const { return &value; } const_pointer address(const_reference value) const { return &value; } new_alloc() throw () { } new_alloc(const new_alloc&) throw () { } template new_alloc(const new_alloc&) throw () { } ~new_alloc() throw () { } template operator std::allocator() { static std::allocator helper_allocator; return helper_allocator; } // return maximum number of elements that can be allocated size_type max_size() const throw () { return std::numeric_limits::max() / sizeof(Type); } // allocate but don't initialize num elements of type Type pointer allocate(size_type num, const void* = 0) { return static_cast(Type::operator new (num * sizeof(Type))); } // _GLIBCXX_RESOLVE_LIB_DEFECTS // 402. wrong new expression in [some_] allocator::construct // initialize elements of allocated storage p with value value void construct(pointer p, const Type& value) { // initialize memory with placement new ::new ((void*)p)Type(value); } #ifdef __GXX_EXPERIMENTAL_CXX0X__ template void construct(pointer p, Args&& ... args) { ::new ((void*)p)Type(std::forward(args) ...); } #endif // destroy elements of initialized storage p void destroy(pointer p) { // destroy objects by calling their destructor p->~Type(); } // deallocate storage p of deleted elements void deallocate(pointer p, size_type /*num*/) { Type::operator delete (p); } }; // return that all specializations of this allocator are interchangeable template inline bool operator == (const new_alloc&, const new_alloc&) throw () { return true; } template inline bool operator != (const new_alloc&, const new_alloc&) throw () { return false; } STXXL_END_NAMESPACE #endif // !STXXL_COMMON_NEW_ALLOC_HEADER // vim: et:ts=4:sw=4