50 #ifndef TEUCHOS_DETAILS_ALLOCATOR 51 #define TEUCHOS_DETAILS_ALLOCATOR 57 #ifdef HAVE_TEUCHOSCORE_CXX11 58 # include <type_traits> 59 #endif // HAVE_TEUCHOSCORE_CXX11 245 #ifdef HAVE_TEUCHOSCORE_CXX11 249 #endif // HAVE_TEUCHOSCORE_CXX11 264 const bool verboseOutput) :
291 return std::numeric_limits<size_type>::max();
307 return (
value_type*) (::operator
new (
n *
sizeof (T)));
322 ::operator
delete ((
void*) p);
335 #ifndef HAVE_TEUCHOSCORE_CXX11 348 new ((
void*) p) T (val);
350 #endif // HAVE_TEUCHOSCORE_CXX11 352 #ifndef HAVE_TEUCHOSCORE_CXX11 365 #endif // HAVE_TEUCHOSCORE_CXX11 380 template<
class T,
class U>
386 template<
class T,
class U>
388 return ! (a_t == a_u);
394 #endif // TEUCHOS_DETAILS_ALLOCATOR
AllocationLogger::size_type size_type
Type of the size of an allocation or deallocation.
std::string typeName(const T &t)
Template function for returning the concrete type name of a passed-in object.
const T & const_reference
Type of a reference to const T.
Allocator(const bool trackMemory, const bool verboseOutput)
Constructor.
Allocator(const Allocator< U > &src)
Copy constructor that takes an Allocator<U> for any U.
EAllocatorOp
Internal enum, identifying whether an operation is an allocation or a deallocation.
void construct(pointer p, const_reference val)
Invoke the constructor of an instance of T, without allocating.
size_type maxAllocInBytes()
Max total allocation ("high water mark") in bytes, over all Allocator<U>.
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
std::ptrdiff_t difference_type
Integer type representing the difference between two pointers.
Optional tracking allocator for Teuchos Memory Management classes.
size_type max_size() const
Upper bound (possibly loose) on maximum allocation size.
Logging implementation used by Allocator (see below).
const T * const_pointer
Type of a pointer to const T.
Mapping to an Allocator for a different type U.
Namespace of implementation details.
bool operator!=(const Allocator< T > &a_t, const Allocator< U > &a_u)
Return ! (a_t == a_u) (see above).
static size_type maxAllocInBytes_
Max total allocation ("high water mark") in bytes.
T * pointer
Type of a pointer to T.
T & reference
Type of a reference to T.
bool tracking() const
Whether this Allocator logs.
bool operator==(const Allocator< T > &, const Allocator< U > &)
Return true if and only if the two input Allocator instances are interchangeable. ...
Allocator()
Default constructor.
std::size_t size_type
Type of the size of an allocation or deallocation.
bool verbose() const
Whether this allocator prints verbosely.
static void resetAllocationCounts()
Reset the current and max total allocation numbers to zero.
static void logAllocation(std::ostream &out, const size_type numEntries, const size_type numBytes, const char typeName[], const bool verbose)
Log an allocation.
static size_type curAllocInBytes_
Current total allocation in bytes.
T value_type
Type of the template parameter of this class.
void destroy(pointer p)
Invoke the destructor of an instance of T, without deallocating.
static size_type maxAllocInBytes()
Max total allocation ("high water mark") in bytes.
value_type * allocate(const size_type &n, const void *=0)
Allocate an array of n instances of value_type.
static void logDeallocation(std::ostream &out, const size_type numEntries, const size_type numBytes, const char typeName[], const bool verbose)
Log a deallocation, that was previously logged using logAllocation().
static size_type curAllocInBytes()
Current total allocation in bytes.
void deallocate(value_type *p, const size_type &n)
Deallocate n instances of value_type.
size_type curAllocInBytes()
Current total allocation in bytes, over all Allocator<U>.