Ejemplo n.º 1
0
PtrDynArray<T>::PtrDynArray(T** s, size_t n):
DynArrayBase<void*>((void**)s, n)
{
  if (s == 0)
    _Xinv();

  _Tidy(), AssignArg(s, n);
}
Ejemplo n.º 2
0
PtrDynArray<T>::PtrDynArray(size_t n, capacity c):
DynArrayBase<void*>(n, c)
{
  _Tidy(), _Res = n;

  if (c == default_size)
    PtrDynArray<T>::_NVMGrow(n);
}
Ejemplo n.º 3
0
void PtrDynArray<T>::_NVMGrow(size_t n, void* const* s, Boolean Trim_)
{
  size_t Os_ = _Ptr == 0 ? 0:_Res;

  if (n == 0)
  {
    if (Trim_)
      _Tidy(1);
  }
  else if (n == Os_ || n == Os_ && !Trim_)
	;
  else if (n == SIZET_MAX)
    _Xlen();
  else
  {
    size_t i, m = _Ptr == 0 && n < _Res ? _Res:n;

    Boolean Active_ = MemMatrix::Matrix().IsNewHandlerActive();
    MemMatrix::Matrix().SetNewHandlerInactive();

#if OVERLOAD_NEW
    void** Np_ = (void**)MemMatrix::Matrix().Allocate(sizeof(void*) * m);
#else
    void** Np_ = new void*[m];
#endif

    if (Np_ == 0)
      MemMatrix::Matrix().NoMemory();

    if (Active_)
      MemMatrix::Matrix().SetNewHandlerActive();

    _Res = m, m = n < _Len ? n:_Len;

    for (i = 0; i < m; ++i)
      Np_[i] = _Ptr[i];

    if (s != 0)
      for (; i < _Res; ++i)
	Np_[i] = *s;

    _Tidy(1), _Ptr = Np_;
  }

  _Len = n;
}
		void _Construct(_Iter _First,
			_Iter _Last, input_iterator_tag)
		{	// initialize with [_First, _Last), input iterators
		_TRY_BEGIN
		insert(begin(), _First, _Last);
		_CATCH_ALL
		_Tidy();
		_RERAISE;
		_CATCH_END
		}
Ejemplo n.º 5
0
PtrDynArray<T>::PtrDynArray(const PtrDynArray<T>& x):
ObjectImp((ObjectImp&)x),
DynArrayBase<void*>(x)
{
  _Tidy();
  PtrDynArray<T>::_NVMGrow(x.RunLength());

  size_t i;
  for (i = 0; i < _Len; ++i)
    _Ptr[i] = x[i];
}
	void _Construct_n(size_type _Count, const _Ty *_Pval)
		{	// construct from _Count * *_Pval
		if (_Buy(_Count))
			{	// nonzero, fill it
			_TRY_BEGIN
			this->_Mylast = _Ufill(this->_Myfirst, _Count, _Pval);
			_CATCH_ALL
			_Tidy();
			_RERAISE;
			_CATCH_END
			}
		}
Ejemplo n.º 7
0
	vector(const _Myt& _Right)
		: _Mybase(_Right._Alval)
		{	// construct by copying _Right
		if (_Buy(_Right.size()))
			_TRY_BEGIN
			this->_Mylast = _Ucopy(_Right.begin(), _Right.end(),
				this->_Myfirst);
			_CATCH_ALL
			_Tidy();
			_RERAISE;
			_CATCH_END
		}
	void _Assign_rv(_Myt&& _Right)
		{	// assign by moving _Right
		if (this == &_Right)
			;
		else if (get_allocator() != _Right.get_allocator())
			{	// move construct a copy
			clear();
			for (iterator _Next = _Right.begin(); _Next != _Right.end();
				++_Next)
				push_back(_STD forward<_Ty>(*_Next));
			}
		else
			{	// clear this and steal from _Right
			_Tidy();
			this->_Swap_all((_Myt&)_Right);
			this->_Myfirst = _Right._Myfirst;
			this->_Mylast = _Right._Mylast;
			this->_Myend = _Right._Myend;

			_Right._Myfirst = 0;
			_Right._Mylast = 0;
			_Right._Myend = 0;
			}
		}
	~vectorfix()
		{	// destroy the object
		_Tidy();
		}
Ejemplo n.º 10
0
PtrDynArray<T>::PtrDynArray(T* x, size_t n):
DynArrayBase<void*>((void*)x, n)
{
  _Tidy();
  PtrDynArray<T>::_NVMGrow(n, (void**)&x);
}
Ejemplo n.º 11
0
PtrDynArray<T>::PtrDynArray():
DynArrayBase<void*>()
{
  _Tidy();
}
Ejemplo n.º 12
0
strstreambuf::~strstreambuf()
	{	// destroy a strstreambuf
	_Tidy();
	}
_CRTIMP2 strstreambuf::~strstreambuf()
	{	// destruct a strstreambuf
	_Tidy();
	}