Generated on Sat Feb 7 2015 02:01:41 for Gecode by doxygen 1.8.9.1
Gecode::space_allocator< T > Struct Template Reference

Allocator that allocates memory from a space heap. More...

#include <allocators.hpp>

Classes

struct  rebind
 Rebinding helper (returns the type of a similar allocator for type U). More...
 

Public Types

typedef T value_type
 Type of objects the allocator creates. This is identical to T. More...
 
typedef size_t size_type
 Type that can represent the size of the largest object. More...
 
typedef ptrdiff_t difference_type
 Type that can represent the difference between any two pointers. More...
 
typedef T * pointer
 Type of pointers returned by the allocator. More...
 
typedef T const * const_pointer
 Const version of pointer. More...
 
typedef T & reference
 Non-const reference to T. More...
 
typedef T const & const_reference
 Const reference to T. More...
 

Public Member Functions

 space_allocator (Space &space) throw ()
 Construction. More...
 
 space_allocator (space_allocator const &al) throw ()
 Copy construction. More...
 
space_allocatoroperator= (space_allocator const &al)
 Assignment operator. More...
 
template<class U >
 space_allocator (space_allocator< U > const &al) throw ()
 Copy from other instantiation. More...
 
pointer address (reference x) const
 Convert a reference x to a pointer. More...
 
const_pointer address (const_reference x) const
 Convert a const reference x to a const pointer. More...
 
size_type max_size (void) const throw ()
 Returns the largest size for which a call to allocate might succeed. More...
 
pointer allocate (size_type count)
 Allocates storage. More...
 
pointer allocate (size_type count, const void *const hint)
 Allocates storage. More...
 
void deallocate (pointer p, size_type count)
 Deallocates the storage obtained by a call to allocate() with arguments count and p. More...
 
void construct (pointer element, const_reference t)
 
void destroy (pointer element)
 Calls the destructor on the object pointed to by element. More...
 

Public Attributes

Spacespace
 The space that we allocate objects from. More...
 

Detailed Description

template<class T>
struct Gecode::space_allocator< T >

Allocator that allocates memory from a space heap.

Note that this allocator may be used to construct dynamic data structures that allocate memory from the space heap, or even reside in the space heap as a whole.

Definition at line 40 of file allocators.hpp.

Member Typedef Documentation

template<class T>
typedef T Gecode::space_allocator< T >::value_type

Type of objects the allocator creates. This is identical to T.

Definition at line 179 of file allocators.hpp.

template<class T>
typedef size_t Gecode::space_allocator< T >::size_type

Type that can represent the size of the largest object.

Definition at line 181 of file allocators.hpp.

template<class T>
typedef ptrdiff_t Gecode::space_allocator< T >::difference_type

Type that can represent the difference between any two pointers.

Definition at line 183 of file allocators.hpp.

template<class T>
typedef T* Gecode::space_allocator< T >::pointer

Type of pointers returned by the allocator.

Definition at line 185 of file allocators.hpp.

template<class T>
typedef T const* Gecode::space_allocator< T >::const_pointer

Const version of pointer.

Definition at line 187 of file allocators.hpp.

template<class T>
typedef T& Gecode::space_allocator< T >::reference

Non-const reference to T.

Definition at line 189 of file allocators.hpp.

template<class T>
typedef T const& Gecode::space_allocator< T >::const_reference

Const reference to T.

Definition at line 191 of file allocators.hpp.

Constructor & Destructor Documentation

template<class T>
Gecode::space_allocator< T >::space_allocator ( Space space)
throw (
)
inline

Construction.

Parameters
spaceThe space whose heap to allocate objects from.

Definition at line 205 of file allocators.hpp.

template<class T>
Gecode::space_allocator< T >::space_allocator ( space_allocator< T > const &  al)
throw (
)
inline

Copy construction.

Parameters
alThe allocator to copy.

Definition at line 210 of file allocators.hpp.

template<class T>
template<class U >
Gecode::space_allocator< T >::space_allocator ( space_allocator< U > const &  al)
throw (
)
inline

Copy from other instantiation.

Parameters
alThe source allocator.

Definition at line 225 of file allocators.hpp.

Member Function Documentation

template<class T>
space_allocator& Gecode::space_allocator< T >::operator= ( space_allocator< T > const &  al)
inline

Assignment operator.

Parameters
alThe allocator to assign.

Definition at line 215 of file allocators.hpp.

template<class T>
pointer Gecode::space_allocator< T >::address ( reference  x) const
inline

Convert a reference x to a pointer.

Definition at line 228 of file allocators.hpp.

template<class T>
const_pointer Gecode::space_allocator< T >::address ( const_reference  x) const
inline

Convert a const reference x to a const pointer.

Definition at line 230 of file allocators.hpp.

template<class T>
size_type Gecode::space_allocator< T >::max_size ( void  ) const
throw (
)
inline

Returns the largest size for which a call to allocate might succeed.

Definition at line 232 of file allocators.hpp.

template<class T>
pointer Gecode::space_allocator< T >::allocate ( size_type  count)
inline

Allocates storage.

Returns a pointer to the first element in a block of storage count*sizeof(T) bytes in size. The block is aligned appropriately for objects of type T. Throws the exception bad_alloc if the storage is unavailable.

Definition at line 244 of file allocators.hpp.

template<class T>
pointer Gecode::space_allocator< T >::allocate ( size_type  count,
const void *const  hint 
)
inline

Allocates storage.

Returns a pointer to the first element in a block of storage count*sizeof(T) bytes in size. The block is aligned appropriately for objects of type T. Throws the exception bad_alloc if the storage is unavailable. The (unused) parameter could be used as an allocation hint, but this allocator ignores it.

Definition at line 258 of file allocators.hpp.

template<class T>
void Gecode::space_allocator< T >::deallocate ( pointer  p,
size_type  count 
)
inline

Deallocates the storage obtained by a call to allocate() with arguments count and p.

Definition at line 264 of file allocators.hpp.

template<class T>
void Gecode::space_allocator< T >::construct ( pointer  element,
const_reference  t 
)
inline

Definition at line 275 of file allocators.hpp.

template<class T>
void Gecode::space_allocator< T >::destroy ( pointer  element)
inline

Calls the destructor on the object pointed to by element.

Definition at line 280 of file allocators.hpp.

Member Data Documentation

template<class T>
Space& Gecode::space_allocator< T >::space

The space that we allocate objects from.

Definition at line 199 of file allocators.hpp.


The documentation for this struct was generated from the following file: