_Myt& operator=(const _Myt& _Right)
		{	// assign _Right
		if (this != &_Right)
			{	// worth doing
			this->_Orphan_all();

			if (_Right.size() == 0)
				clear();	// new sequence empty, erase existing sequence
			else if (_Right.size() <= size())
				{	// enough elements, copy new and destroy old
				pointer _Ptr = _STD _Copy_impl(_Right._Myfirst, _Right._Mylast,
					this->_Myfirst);	// copy new
				_Destroy(_Ptr, this->_Mylast);	// destroy old
				this->_Mylast = this->_Myfirst + _Right.size();
				}
			else if (_Right.size() <= capacity())
				{	// enough room, copy and construct new
				pointer _Ptr = _Right._Myfirst + size();
				_STD _Copy_impl(_Right._Myfirst, _Ptr, this->_Myfirst);
				this->_Mylast = _Ucopy(_Ptr, _Right._Mylast, this->_Mylast);
				}
			else
				{	// not enough room, allocate new array and construct new
				if (this->_Myfirst != 0)
					{	// discard old array
					_Destroy(this->_Myfirst, this->_Mylast);
					this->_Alval.deallocate(this->_Myfirst,
						this->_Myend - this->_Myfirst);
					}
				if (_Buy(_Right.size()))
					this->_Mylast = _Ucopy(_Right._Myfirst, _Right._Mylast,
						this->_Myfirst);
				}
			}
		return (*this);
		}
Exemplo n.º 2
0
	void RunLength::runlength_encoding(cv::Mat im, float* output){
		
		int l = im.rows*im.cols;
		int* a = new int[im.rows*im.cols];
		mat2vector(im, a);

		int* RL = new int[72];
		for (int i = 0; i < 72; i++)
			RL[i] = 0;

		int width = im.cols;
		int heigth = im.rows;

		DoVerticalRunlength(width, heigth, a, RL);
		DoHorizontalRunlength(width, heigth, a, &RL[18]);
		DoDiagonalRunlength(width, heigth, a, &RL[36]);
		DoAntiDiagonalRunlength(width, heigth, a, &RL[54]);

		_Copy_impl(RL, RL + 72, output);

		delete[] a;
		delete[] RL;
	}