ReactOS  0.4.14-dev-297-g23e575c
_Temporary_buffer< _ForwardIterator, _Tp > Class Template Reference

#include <_tempbuf.h>

Inheritance diagram for _Temporary_buffer< _ForwardIterator, _Tp >:

Public Member Functions

ptrdiff_t size () const
 
ptrdiff_t requested_size () const
 
_Tp * begin ()
 
_Tp * end ()
 
 _Temporary_buffer (_ForwardIterator __first, _ForwardIterator __last)
 
 ~_Temporary_buffer ()
 

Private Member Functions

void _M_allocate_buffer ()
 
void _M_initialize_buffer (const _Tp &, const __true_type &)
 
void _M_initialize_buffer (const _Tp &val, const __false_type &)
 
 _Temporary_buffer (const _Temporary_buffer< _ForwardIterator, _Tp > &)
 
void operator= (const _Temporary_buffer< _ForwardIterator, _Tp > &)
 

Private Attributes

ptrdiff_t _M_original_len
 
ptrdiff_t _M_len
 
_Tp * _M_buffer
 

Detailed Description

template<class _ForwardIterator, class _Tp>
class _Temporary_buffer< _ForwardIterator, _Tp >

Definition at line 79 of file _tempbuf.h.

Constructor & Destructor Documentation

◆ _Temporary_buffer() [1/2]

template<class _ForwardIterator, class _Tp>
_Temporary_buffer< _ForwardIterator, _Tp >::_Temporary_buffer ( _ForwardIterator  __first,
_ForwardIterator  __last 
)
inline

Definition at line 111 of file _tempbuf.h.

111  {
112  // Workaround for a __type_traits bug in the pre-7.3 compiler.
113 # if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
114  typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
115 # else
116  typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Trivial;
117 # endif
118  _STLP_TRY {
119  _M_len = _STLP_STD::distance(__first, __last);
121  if (_M_len > 0)
122  _M_initialize_buffer(*__first, _Trivial());
123  }
125  }
void _M_initialize_buffer(const _Tp &, const __true_type &)
Definition: _tempbuf.h:100
#define free
Definition: debug_ros.c:5
GLsizei GLsizei GLfloat distance
Definition: glext.h:11755
#define _STLP_UNWIND(action)
Definition: features.h:824
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
ptrdiff_t _M_len
Definition: _tempbuf.h:82
#define _STLP_TRY
Definition: features.h:817
void _M_allocate_buffer()
Definition: _tempbuf.h:85

◆ ~_Temporary_buffer()

template<class _ForwardIterator, class _Tp>
_Temporary_buffer< _ForwardIterator, _Tp >::~_Temporary_buffer ( )
inline

Definition at line 127 of file _tempbuf.h.

127  {
129  free(_M_buffer);
130  }
#define free
Definition: debug_ros.c:5
void _Destroy_Range(_ForwardIterator __first, _ForwardIterator __last)
Definition: _construct.h:219
ptrdiff_t _M_len
Definition: _tempbuf.h:82

◆ _Temporary_buffer() [2/2]

template<class _ForwardIterator, class _Tp>
_Temporary_buffer< _ForwardIterator, _Tp >::_Temporary_buffer ( const _Temporary_buffer< _ForwardIterator, _Tp > &  )
inlineprivate

Definition at line 134 of file _tempbuf.h.

134 {}

Member Function Documentation

◆ _M_allocate_buffer()

template<class _ForwardIterator, class _Tp>
void _Temporary_buffer< _ForwardIterator, _Tp >::_M_allocate_buffer ( )
inlineprivate

Definition at line 85 of file _tempbuf.h.

85  {
87  _M_buffer = 0;
88 
89  if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
90  _M_len = INT_MAX / sizeof(_Tp);
91 
92  while (_M_len > 0) {
93  _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
94  if (_M_buffer)
95  break;
96  _M_len /= 2;
97  }
98  }
#define INT_MAX
Definition: limits.h:40
ptrdiff_t _M_original_len
Definition: _tempbuf.h:81
ptrdiff_t _M_len
Definition: _tempbuf.h:82
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define malloc
Definition: debug_ros.c:4

Referenced by _Temporary_buffer< _ForwardIterator, _Tp >::_Temporary_buffer().

◆ _M_initialize_buffer() [1/2]

template<class _ForwardIterator, class _Tp>
void _Temporary_buffer< _ForwardIterator, _Tp >::_M_initialize_buffer ( const _Tp &  ,
const __true_type  
)
inlineprivate

Definition at line 100 of file _tempbuf.h.

100 {}

Referenced by _Temporary_buffer< _ForwardIterator, _Tp >::_Temporary_buffer().

◆ _M_initialize_buffer() [2/2]

template<class _ForwardIterator, class _Tp>
void _Temporary_buffer< _ForwardIterator, _Tp >::_M_initialize_buffer ( const _Tp &  val,
const __false_type  
)
inlineprivate

Definition at line 101 of file _tempbuf.h.

101  {
103  }
GLuint GLfloat * val
Definition: glext.h:7180
_STLP_MOVE_TO_STD_NAMESPACE void uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp &__x)
ptrdiff_t _M_len
Definition: _tempbuf.h:82

◆ begin()

template<class _ForwardIterator, class _Tp>
_Tp* _Temporary_buffer< _ForwardIterator, _Tp >::begin ( )
inline

Definition at line 108 of file _tempbuf.h.

108 { return _M_buffer; }

Referenced by __inplace_merge_aux(), and __stable_partition_aux_aux().

◆ end()

template<class _ForwardIterator, class _Tp>
_Tp* _Temporary_buffer< _ForwardIterator, _Tp >::end ( )
inline

Definition at line 109 of file _tempbuf.h.

109 { return _M_buffer + _M_len; }
ptrdiff_t _M_len
Definition: _tempbuf.h:82

◆ operator=()

template<class _ForwardIterator, class _Tp>
void _Temporary_buffer< _ForwardIterator, _Tp >::operator= ( const _Temporary_buffer< _ForwardIterator, _Tp > &  )
inlineprivate

Definition at line 135 of file _tempbuf.h.

135 {}

◆ requested_size()

template<class _ForwardIterator, class _Tp>
ptrdiff_t _Temporary_buffer< _ForwardIterator, _Tp >::requested_size ( ) const
inline

Definition at line 107 of file _tempbuf.h.

107 { return _M_original_len; }
ptrdiff_t _M_original_len
Definition: _tempbuf.h:81

Referenced by __stable_partition_aux_aux().

◆ size()

template<class _ForwardIterator, class _Tp>
ptrdiff_t _Temporary_buffer< _ForwardIterator, _Tp >::size ( ) const
inline

Definition at line 106 of file _tempbuf.h.

106 { return _M_len; }
ptrdiff_t _M_len
Definition: _tempbuf.h:82

Referenced by __inplace_merge_aux(), and __stable_partition_aux_aux().

Member Data Documentation

◆ _M_buffer

◆ _M_len

◆ _M_original_len

template<class _ForwardIterator, class _Tp>
ptrdiff_t _Temporary_buffer< _ForwardIterator, _Tp >::_M_original_len
private

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