STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Macros | Functions
xmemory0 File Reference
#include <cstdlib>
#include <limits>
#include <new>
#include <xutility>
#include <xatomic.h>

Classes

struct  _Is_simple_alloc< _Alty >
 
struct  _Simple_types< _Value_type >
 
struct  _Get_voidptr< _Alty, _Pointer >
 
struct  _Get_voidptr< _Alty, _Ty * >
 
struct  _Is_iterator< _Iter >
 
struct  _Get_first_parameter< _Ty >
 
struct  _Get_first_parameter< _Ty< _First, _Rest...> >
 
struct  _Replace_first_parameter< _Newfirst, _Ty >
 
struct  _Replace_first_parameter< _Newfirst, _Ty< _First, _Rest...> >
 
struct  pointer_traits< _Ty >
 
struct  pointer_traits< _Ty * >
 
struct  _Alloc_allocate
 
struct  _Alloc_construct
 
struct  _Alloc_destroy
 
struct  _Alloc_max_size
 
struct  _Alloc_select
 
struct  allocator_traits< _Alloc >
 
struct  _Allocator_base< _Ty >
 
struct  _Allocator_base< const _Ty >
 
class  allocator< _Ty >
 
struct  allocator< _Ty >::rebind< _Other >
 
class  allocator< void >
 
struct  allocator< void >::rebind< _Other >
 
struct  allocator_traits< allocator< _Ty > >
 
struct  _Wrap_alloc< _Alloc >
 
struct  _Wrap_alloc< _Alloc >::rebind< _Other >
 

Macros

#define _XMEMORY0_
 
#define _MT_INCR(mtx, x)   _Inc_atomic_counter_explicit(x, memory_order_relaxed)
 
#define _MT_DECR(mtx, x)   _Dec_atomic_counter_explicit(x, memory_order_seq_cst)
 

Functions

template<class _Ty >
_STD_BEGIN _Ty * _Allocate (size_t _Count, _Ty *)
 
template<class _Ty1 , class _Ty2 >
void _Construct (_Ty1 *_Ptr, _Ty2 &&_Val)
 
template<class _Ty1 >
void _Construct (_Ty1 *_Ptr)
 
template<class _Ty >
void _Destroy (_Ty *_Ptr)
 
template<>
void _Destroy (char *)
 
template<>
void _Destroy (wchar_t *)
 
template<class _Alloc >
void _Destroy_range (typename _Alloc::pointer _First, typename _Alloc::pointer _Last, _Alloc &_Al, _Nonscalar_ptr_iterator_tag)
 
template<class _Alloc >
void _Destroy_range (typename _Alloc::pointer _First, typename _Alloc::pointer _Last, _Alloc &_Al, _Scalar_ptr_iterator_tag)
 
template<class _Alloc >
void _Destroy_range (typename _Alloc::pointer _First, typename _Alloc::pointer _Last, _Alloc &_Al)
 
template<class _Ty >
struct _Get_element_type _GET_TYPE_OR_DEFAULT (element_type, typename _Get_first_parameter< _Uty >::type)
 
template<class _Ty >
struct _Get_ptr_difference_type _GET_TYPE_OR_DEFAULT (difference_type, ptrdiff_t)
 
template<class _Ty , class _Other >
struct _Get_rebind_type _GET_TYPE_OR_DEFAULT (template rebind< _Other >::other, typename _Replace_first_parameter< _Other _COMMA _Uty >::type)
 
template<class _Ty >
struct _Get_pointer_type _GET_TYPE_OR_DEFAULT (pointer, typename _Ty::value_type *)
 
template<class _Ty >
struct _Get_const_pointer_type _GET_TYPE_OR_DEFAULT (const_pointer, typename pointer_traits< typename _Get_pointer_type< _Ty >::type >::template rebind< const typename _Ty::value_type >)
 
template<class _Ty >
struct _Get_void_pointer_type _GET_TYPE_OR_DEFAULT (void_pointer, typename pointer_traits< typename _Get_pointer_type< _Ty >::type >::template rebind< void >)
 
template<class _Ty >
struct _Get_const_void_pointer_type _GET_TYPE_OR_DEFAULT (const_void_pointer, typename pointer_traits< typename _Get_pointer_type< _Ty >::type >::template rebind< const void >)
 
template<class _Ty >
struct _Get_difference_type _GET_TYPE_OR_DEFAULT (difference_type, typename _Get_ptr_difference_type< typename _Get_pointer_type< _Ty >::type >::type)
 
template<class _Ty >
struct _Get_size_type _GET_TYPE_OR_DEFAULT (size_type, typename make_unsigned< typename _Get_difference_type< _Ty >::type >::type)
 
template<class _Ty >
struct _Get_propagate_on_container_copy _GET_TYPE_OR_DEFAULT (propagate_on_container_copy_assignment, false_type)
 
template<class _Ty >
struct _Get_propagate_on_container_move _GET_TYPE_OR_DEFAULT (propagate_on_container_move_assignment, false_type)
 
template<class _Ty >
struct _Get_propagate_on_container_swap _GET_TYPE_OR_DEFAULT (propagate_on_container_swap, false_type)
 
template<class _Ty , class _Other >
bool operator== (const allocator< _Ty > &, const allocator< _Other > &) _THROW0()
 
template<class _Ty , class _Other >
bool operator!= (const allocator< _Ty > &_Left, const allocator< _Other > &_Right) _THROW0()
 
template<class _Ty , class _Other >
bool operator== (const _Wrap_alloc< _Ty > &_Left, const _Wrap_alloc< _Other > &_Right) _THROW0()
 
template<class _Ty , class _Other >
bool operator!= (const _Wrap_alloc< _Ty > &_Left, const _Wrap_alloc< _Other > &_Right) _THROW0()
 

Macro Definition Documentation

#define _MT_DECR (   mtx,
 
)    _Dec_atomic_counter_explicit(x, memory_order_seq_cst)
#define _MT_INCR (   mtx,
 
)    _Inc_atomic_counter_explicit(x, memory_order_relaxed)
#define _XMEMORY0_

Function Documentation

template<class _Ty >
_STD_BEGIN _Ty* _Allocate ( size_t  _Count,
_Ty *   
)
inline
22  { // allocate storage for _Count elements of type _Ty
23  void *_Ptr = 0;
24 
25  if (_Count == 0)
26  ;
27  else if (((size_t)(-1) / sizeof (_Ty) < _Count)
28  || (_Ptr = ::operator new(_Count * sizeof (_Ty))) == 0)
29  _Xbad_alloc(); // report no memory
30 
31  return ((_Ty *)_Ptr);
32  }
_Diff _Count
Definition: algorithm:1941
template<class _Ty1 , class _Ty2 >
void _Construct ( _Ty1 *  _Ptr,
_Ty2 &&  _Val 
)
inline
38  { // construct object at _Ptr with value _Val
39  void *_Vptr = _Ptr;
40  ::new (_Vptr) _Ty1(_STD forward<_Ty2>(_Val));
41  }
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty1 >
void _Construct ( _Ty1 *  _Ptr)
inline
45  { // construct object at _Ptr with default value
46  void *_Vptr = _Ptr;
47 
48  ::new (_Vptr) _Ty1();
49  }
template<class _Ty >
void _Destroy ( _Ty *  _Ptr)
inline
54  { // destroy object at _Ptr
55  _Ptr->~_Ty();
56  }
template<>
void _Destroy ( char *  )
inline
60  { // destroy a char (do nothing)
61  }
template<>
void _Destroy ( wchar_t )
inline
65  { // destroy a wchar_t (do nothing)
66  }
template<class _Alloc >
void _Destroy_range ( typename _Alloc::pointer  _First,
typename _Alloc::pointer  _Last,
_Alloc &  _Al,
_Nonscalar_ptr_iterator_tag   
)
inline
80  { // destroy [_First, _Last), arbitrary type
81  for (; _First != _Last; ++_First)
82  _Al.destroy(_First);
83  }
_FwdIt _Last
Definition: algorithm:1936
template<class _Alloc >
void _Destroy_range ( typename _Alloc::pointer  _First,
typename _Alloc::pointer  _Last,
_Alloc &  _Al,
_Scalar_ptr_iterator_tag   
)
inline
89  { // destroy [_First, _Last), scalar type (do nothing)
90  }
template<class _Alloc >
void _Destroy_range ( typename _Alloc::pointer  _First,
typename _Alloc::pointer  _Last,
_Alloc &  _Al 
)
inline
95  { // destroy [_First, _Last)
96  _Destroy_range(_First, _Last, _Al, _Ptr_cat(_First, _Last));
97  }
_Nonscalar_ptr_iterator_tag _Ptr_cat(_Iter1 &, _Iter2 &)
Definition: xutility:413
void _Destroy_range(typename _Alloc::pointer _First, typename _Alloc::pointer _Last, _Alloc &_Al, _Nonscalar_ptr_iterator_tag)
Definition: xmemory0:77
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty >
struct _Get_propagate_on_container_copy _GET_TYPE_OR_DEFAULT ( propagate_on_container_copy_assignment  ,
false_type   
)
template<class _Ty >
struct _Get_const_void_pointer_type _GET_TYPE_OR_DEFAULT ( const_void_pointer  ,
typename pointer_traits< typename _Get_pointer_type< _Ty >::type >::template rebind< const void  
)
template<class _Ty >
struct _Get_void_pointer_type _GET_TYPE_OR_DEFAULT ( void_pointer  ,
typename pointer_traits< typename _Get_pointer_type< _Ty >::type >::template rebind< void  
)
template<class _Ty >
struct _Get_const_pointer_type _GET_TYPE_OR_DEFAULT ( const_pointer  ,
typename pointer_traits< typename _Get_pointer_type< _Ty >::type >::template rebind< const typename _Ty::value_type >   
)
template<class _Ty >
struct _Get_difference_type _GET_TYPE_OR_DEFAULT ( difference_type  ,
typename _Get_ptr_difference_type< typename _Get_pointer_type< _Ty >::type >::type   
)
template<class _Ty >
struct _Get_size_type _GET_TYPE_OR_DEFAULT ( size_type  ,
typename make_unsigned< typename _Get_difference_type< _Ty >::type >::type   
)
template<class _Ty >
struct _Get_ptr_difference_type _GET_TYPE_OR_DEFAULT ( difference_type  ,
ptrdiff_t   
)
template<class _Ty >
struct _Get_element_type _GET_TYPE_OR_DEFAULT ( element_type  ,
typename _Get_first_parameter< _Uty >::type   
)
template<class _Ty >
struct _Get_propagate_on_container_move _GET_TYPE_OR_DEFAULT ( propagate_on_container_move_assignment  ,
false_type   
)
template<class _Ty , class _Other >
struct _Get_rebind_type _GET_TYPE_OR_DEFAULT ( template rebind< _Other >::other  ,
typename _Replace_first_parameter< _Other _COMMA _Uty >::type   
)
template<class _Ty >
struct _Get_propagate_on_container_swap _GET_TYPE_OR_DEFAULT ( propagate_on_container_swap  ,
false_type   
)
template<class _Ty >
struct _Get_pointer_type _GET_TYPE_OR_DEFAULT ( pointer  ,
typename _Ty::value_type *   
)
template<class _Ty , class _Other >
bool operator!= ( const allocator< _Ty > &  _Left,
const allocator< _Other > &  _Right 
)
inline
668  { // test for allocator inequality
669  return (!(_Left == _Right));
670  }
template<class _Ty , class _Other >
bool operator!= ( const _Wrap_alloc< _Ty > &  _Left,
const _Wrap_alloc< _Other > &  _Right 
)
inline
900  { // test for allocator inequality
901  return (!(_Left == _Right));
902  }
template<class _Ty , class _Other >
bool operator== ( const allocator< _Ty > &  ,
const allocator< _Other > &   
)
inline
660  { // test for allocator equality
661  return (true);
662  }
template<class _Ty , class _Other >
bool operator== ( const _Wrap_alloc< _Ty > &  _Left,
const _Wrap_alloc< _Other > &  _Right 
)
inline
892  { // test for allocator equality
893  return (static_cast<_Ty>(_Left) == static_cast<_Other>(_Right));
894  }