ReactOS 0.4.15-dev-7961-gdcf9eb0
_construct.h File Reference
#include <stl/_cstring.h>
#include <stl/_new.h>
#include <stl/_iterator_base.h>
#include <stl/type_traits.h>
#include <stl/_move_construct_fwk.h>
Include dependency graph for _construct.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _STLP_DEFAULT_CONSTRUCTED(_TTp)   _TTp()
 

Functions

template<class _Tp >
_STLP_BEGIN_NAMESPACE void __destroy_aux (_Tp *__pointer, const __false_type &)
 
template<class _Tp >
void __destroy_aux (_Tp *, const __true_type &)
 
template<class _Tp >
void _Destroy (_Tp *__pointer)
 
template<class _Tp >
void _Destroy_Moved (_Tp *__pointer)
 
template<class _T1 >
void _Construct_aux (_T1 *__p, const __false_type &)
 
template<class _T1 >
void _Construct_aux (_T1 *__p, const __true_type &)
 
template<class _T1 >
void _Construct (_T1 *__p)
 
template<class _Tp >
void _Copy_Construct_aux (_Tp *__p, const _Tp &__val, const __false_type &)
 
template<class _Tp >
void _Copy_Construct_aux (_Tp *__p, const _Tp &__val, const __true_type &)
 
template<class _Tp >
void _Copy_Construct (_Tp *__p, const _Tp &__val)
 
template<class _T1 , class _T2 >
void _Param_Construct_aux (_T1 *__p, const _T2 &__val, const __false_type &)
 
template<class _T1 , class _T2 >
void _Param_Construct_aux (_T1 *__p, const _T2 &__val, const __true_type &)
 
template<class _T1 , class _T2 >
void _Param_Construct (_T1 *__p, const _T2 &__val)
 
template<class _T1 , class _T2 >
void _Move_Construct_Aux (_T1 *__p, _T2 &__val, const __false_type &)
 
template<class _T1 , class _T2 >
void _Move_Construct_Aux (_T1 *__p, _T2 &__val, const __true_type &)
 
template<class _T1 , class _T2 >
void _Move_Construct (_T1 *__p, _T2 &__val)
 
template<class _ForwardIterator , class _Tp >
_STLP_INLINE_LOOP void __destroy_range_aux (_ForwardIterator __first, _ForwardIterator __last, _Tp *, const __false_type &)
 
template<class _ForwardIterator , class _Tp >
void __destroy_range_aux (_ForwardIterator, _ForwardIterator, _Tp *, const __true_type &)
 
template<class _ForwardIterator , class _Tp >
void __destroy_range (_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr)
 
template<class _ForwardIterator >
void _Destroy_Range (_ForwardIterator __first, _ForwardIterator __last)
 
void _Destroy_Range (char *, char *)
 
template<class _ForwardIterator , class _Tp >
void __destroy_mv_srcs (_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr)
 
template<class _ForwardIterator >
void _Destroy_Moved_Range (_ForwardIterator __first, _ForwardIterator __last)
 
template<class _T1 , class _T2 >
void construct (_T1 *__p, const _T2 &__val)
 
template<class _T1 >
void construct (_T1 *__p)
 
template<class _Tp >
void destroy (_Tp *__pointer)
 
template<class _ForwardIterator >
void destroy (_ForwardIterator __first, _ForwardIterator __last)
 

Macro Definition Documentation

◆ _STLP_DEFAULT_CONSTRUCTED

#define _STLP_DEFAULT_CONSTRUCTED (   _TTp)    _TTp()

Definition at line 265 of file _construct.h.

Function Documentation

◆ __destroy_aux() [1/2]

template<class _Tp >
void __destroy_aux ( _Tp *  ,
const __true_type  
)
inline

Definition at line 60 of file _construct.h.

60{}

◆ __destroy_aux() [2/2]

template<class _Tp >
_STLP_BEGIN_NAMESPACE void __destroy_aux ( _Tp *  __pointer,
const __false_type  
)
inline

Definition at line 56 of file _construct.h.

57{ __pointer->~_Tp(); }

Referenced by __destroy_range_aux(), _Destroy(), and _Destroy_Moved().

◆ __destroy_mv_srcs()

template<class _ForwardIterator , class _Tp >
void __destroy_mv_srcs ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Tp *  __ptr 
)
inline

Definition at line 232 of file _construct.h.

232 {
233 typedef typename __move_traits<_Tp>::complete _CompleteMove;
234 __destroy_range_aux(__first, __last, __ptr, _CompleteMove());
235}
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
_STLP_INLINE_LOOP void __destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp *, const __false_type &)
Definition: _construct.h:190

Referenced by _Destroy_Moved_Range().

◆ __destroy_range()

template<class _ForwardIterator , class _Tp >
void __destroy_range ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Tp *  __ptr 
)
inline

Definition at line 213 of file _construct.h.

213 {
214 typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
215 __destroy_range_aux(__first, __last, __ptr, _Trivial_destructor());
216}

Referenced by _Destroy_Range().

◆ __destroy_range_aux() [1/2]

template<class _ForwardIterator , class _Tp >
_STLP_INLINE_LOOP void __destroy_range_aux ( _ForwardIterator  __first,
_ForwardIterator  __last,
_Tp *  ,
const __false_type  
)

Definition at line 190 of file _construct.h.

190 {
191 for ( ; __first != __last; ++__first) {
192 __destroy_aux(&(*__first), __false_type());
193#if defined (_STLP_DEBUG_UNINITIALIZED)
194 memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp));
195#endif
196 }
197}
_STLP_BEGIN_NAMESPACE void __destroy_aux(_Tp *__pointer, const __false_type &)
Definition: _construct.h:56
#define _STLP_SHRED_BYTE
Definition: features.h:903
#define memset(x, y, z)
Definition: compat.h:39

Referenced by __destroy_mv_srcs(), and __destroy_range().

◆ __destroy_range_aux() [2/2]

template<class _ForwardIterator , class _Tp >
void __destroy_range_aux ( _ForwardIterator  ,
_ForwardIterator  ,
_Tp *  ,
const __true_type  
)
inline

Definition at line 208 of file _construct.h.

208{}

◆ _Construct()

template<class _T1 >
void _Construct ( _T1 *  __p)
inline

Definition at line 106 of file _construct.h.

106 {
107#if defined (_STLP_DEBUG_UNINITIALIZED)
108 memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
109#endif
110#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
111 _Construct_aux (__p, _HasDefaultZeroValue(__p)._Answer());
112#else
113 _Construct_aux (__p, _Is_POD(__p)._Answer());
114#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
115}
void _Construct_aux(_T1 *__p, const __false_type &)
Definition: _construct.h:90
_DefaultZeroValueQuestion< _Tp > _HasDefaultZeroValue(_Tp *)
Definition: type_traits.h:561
_IsPOD< _Tp > _Is_POD(_Tp *)
Definition: type_traits.h:551

◆ _Construct_aux() [1/2]

template<class _T1 >
void _Construct_aux ( _T1 *  __p,
const __false_type  
)
inline

Definition at line 90 of file _construct.h.

90 {
91 new(__p) _T1();
92}

Referenced by _Construct().

◆ _Construct_aux() [2/2]

template<class _T1 >
void _Construct_aux ( _T1 *  __p,
const __true_type  
)
inline

Definition at line 95 of file _construct.h.

95 {
96#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG)
97 *__p = _T1(0);
98#else
99 // We use binary copying for POD types since it results
100 // in a considerably better code at least on MSVC.
101 *__p = _T1();
102#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */
103}

◆ _Copy_Construct()

template<class _Tp >
void _Copy_Construct ( _Tp *  __p,
const _Tp &  __val 
)
inline

◆ _Copy_Construct_aux() [1/2]

template<class _Tp >
void _Copy_Construct_aux ( _Tp *  __p,
const _Tp &  __val,
const __false_type  
)
inline

Definition at line 118 of file _construct.h.

118 {
119 new(__p) _Tp(__val);
120}

Referenced by _Copy_Construct().

◆ _Copy_Construct_aux() [2/2]

template<class _Tp >
void _Copy_Construct_aux ( _Tp *  __p,
const _Tp &  __val,
const __true_type  
)
inline

Definition at line 123 of file _construct.h.

123 {
124 // We use binary copying for POD types since it results
125 // in a considerably better code at least on MSVC.
126 *__p = __val;
127}

◆ _Destroy()

template<class _Tp >
void _Destroy ( _Tp *  __pointer)
inline

Definition at line 63 of file _construct.h.

63 {
64 typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor;
65 __destroy_aux(__pointer, _Trivial_destructor());
66#if defined (_STLP_DEBUG_UNINITIALIZED)
67 memset(__REINTERPRET_CAST(char*, __pointer), _STLP_SHRED_BYTE, sizeof(_Tp));
68#endif
69}
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586

Referenced by _Destroy_Moved(), and ios_base::_S_uninitialize().

◆ _Destroy_Moved()

template<class _Tp >
void _Destroy_Moved ( _Tp *  __pointer)
inline

Definition at line 72 of file _construct.h.

72 {
73#if !defined (_STLP_NO_MOVE_SEMANTIC)
74 typedef typename __move_traits<_Tp>::complete _Trivial_destructor;
75 __destroy_aux(__pointer, _Trivial_destructor());
76# if defined (_STLP_DEBUG_UNINITIALIZED)
77 memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp));
78# endif
79#else
80 _Destroy(__pointer);
81#endif
82}
void _Destroy(_Tp *__pointer)
Definition: _construct.h:63

◆ _Destroy_Moved_Range()

template<class _ForwardIterator >
void _Destroy_Moved_Range ( _ForwardIterator  __first,
_ForwardIterator  __last 
)
inline

Definition at line 239 of file _construct.h.

241{ __destroy_mv_srcs(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator)); }
void __destroy_mv_srcs(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr)
Definition: _construct.h:232
#define _STLP_VALUE_TYPE(_It, _Tp)

◆ _Destroy_Range() [1/2]

template<class _ForwardIterator >
void _Destroy_Range ( _ForwardIterator  __first,
_ForwardIterator  __last 
)
inline

Definition at line 219 of file _construct.h.

219 {
220 __destroy_range(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator));
221}
void __destroy_range(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr)
Definition: _construct.h:213

Referenced by _CArray< _Tp, _Nb >::~_CArray().

◆ _Destroy_Range() [2/2]

void _Destroy_Range ( char ,
char  
)
inline

Definition at line 223 of file _construct.h.

223{}

◆ _Move_Construct()

template<class _T1 , class _T2 >
void _Move_Construct ( _T1 *  __p,
_T2 &  __val 
)
inline

Definition at line 174 of file _construct.h.

174 {
175#if defined (_STLP_DEBUG_UNINITIALIZED)
176 memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
177#endif
178 _Move_Construct_Aux(__p, __val, _Is_POD(__p)._Answer());
179}
void _Move_Construct_Aux(_T1 *__p, _T2 &__val, const __false_type &)
Definition: _construct.h:158

Referenced by __uninitialized_move().

◆ _Move_Construct_Aux() [1/2]

template<class _T1 , class _T2 >
void _Move_Construct_Aux ( _T1 *  __p,
_T2 &  __val,
const __false_type  
)
inline

Definition at line 158 of file _construct.h.

158 {
159#if !defined (_STLP_NO_MOVE_SEMANTIC)
160 new(__p) _T1(_STLP_PRIV _AsMoveSource(__val));
161#else
163#endif
164}
void _Param_Construct(_T1 *__p, const _T2 &__val)
Definition: _construct.h:150
#define _STLP_PRIV
Definition: _dm.h:70
_STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits< _Tp >::_Type _AsMoveSource(_Tp &src)

Referenced by _Move_Construct().

◆ _Move_Construct_Aux() [2/2]

template<class _T1 , class _T2 >
void _Move_Construct_Aux ( _T1 *  __p,
_T2 &  __val,
const __true_type  
)
inline

Definition at line 167 of file _construct.h.

167 {
168 // We use binary copying for POD types since it results
169 // in a considerably better code at least on MSVC.
170 *__p = _T1(__val);
171}

◆ _Param_Construct()

template<class _T1 , class _T2 >
void _Param_Construct ( _T1 *  __p,
const _T2 &  __val 
)
inline

Definition at line 150 of file _construct.h.

150 {
151#if defined (_STLP_DEBUG_UNINITIALIZED)
152 memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1));
153#endif
154 _Param_Construct_aux(__p, __val, _Is_POD(__p)._Answer());
155}
void _Param_Construct_aux(_T1 *__p, const _T2 &__val, const __false_type &)
Definition: _construct.h:138

Referenced by __ucopy(), __ucopy_n(), __ufill(), __ufill_n(), _Move_Construct_Aux(), construct(), and raw_storage_iterator< _ForwardIterator, _Tp >::operator=().

◆ _Param_Construct_aux() [1/2]

template<class _T1 , class _T2 >
void _Param_Construct_aux ( _T1 *  __p,
const _T2 &  __val,
const __false_type  
)
inline

Definition at line 138 of file _construct.h.

138 {
139 new(__p) _T1(__val);
140}

Referenced by _Param_Construct().

◆ _Param_Construct_aux() [2/2]

template<class _T1 , class _T2 >
void _Param_Construct_aux ( _T1 *  __p,
const _T2 &  __val,
const __true_type  
)
inline

Definition at line 143 of file _construct.h.

143 {
144 // We use binary copying for POD types since it results
145 // in a considerably better code at least on MSVC.
146 *__p = _T1(__val);
147}

◆ construct() [1/2]

template<class _T1 >
void construct ( _T1 *  __p)
inline

Definition at line 276 of file _construct.h.

276{ _STLP_STD::_Construct(__p); }

◆ construct() [2/2]

template<class _T1 , class _T2 >
void construct ( _T1 *  __p,
const _T2 &  __val 
)
inline

Definition at line 274 of file _construct.h.

274{_Param_Construct(__p, __val); }

◆ destroy() [1/2]

template<class _ForwardIterator >
void destroy ( _ForwardIterator  __first,
_ForwardIterator  __last 
)
inline

Definition at line 280 of file _construct.h.

280{ _STLP_STD::_Destroy_Range(__first, __last); }

◆ destroy() [2/2]

template<class _Tp >
void destroy ( _Tp *  __pointer)
inline