added convienience functions to manipulate the first items and the last items in the array class
This commit is contained in:
		| @ -439,6 +439,16 @@ public: | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	const T& getFirst () const | ||||
| 	{ | ||||
| 		return this->getValueAt(0); | ||||
| 	} | ||||
|  | ||||
| 	const T& getLast() const | ||||
| 	{ | ||||
| 		return this->getValueAt(this->getSize() - 1); | ||||
| 	} | ||||
|  | ||||
| protected: | ||||
| 	void secure_slot (qse_size_t index) | ||||
| 	{ | ||||
| @ -576,6 +586,30 @@ public: | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	qse_size_t insertFirst (const T& value) | ||||
| 	{ | ||||
| 		return this->insert (0, value); | ||||
| 	} | ||||
|  | ||||
| #if defined(QSE_CPP_ENABLE_CPP11_MOVE) | ||||
| 	qse_size_t insertFirst (T&& value) | ||||
| 	{ | ||||
| 		return this->insert (0, QSE_CPP_RVREF(value)); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	qse_size_t insertLast (const T& value) | ||||
| 	{ | ||||
| 		return this->insert (this->getSize(), value); | ||||
| 	} | ||||
|  | ||||
| #if defined(QSE_CPP_ENABLE_CPP11_MOVE) | ||||
| 	qse_size_t insertLast (T&& value) | ||||
| 	{ | ||||
| 		return this->insert (this->getSize(), QSE_CPP_RVREF(value)); | ||||
| 	} | ||||
| #endif | ||||
|  | ||||
| 	void remove (qse_size_t index) | ||||
| 	{ | ||||
| 		this->remove (index, 1); | ||||
| @ -623,6 +657,16 @@ public: | ||||
| 		this->count -= to_index - from_index + 1; | ||||
| 	} | ||||
|  | ||||
| 	void removeFirst () | ||||
| 	{ | ||||
| 		this->remove(0); | ||||
| 	} | ||||
|  | ||||
| 	void removeLast () | ||||
| 	{ | ||||
| 		this->remove(this->getSize() - 1); | ||||
| 	} | ||||
|  | ||||
| #if 0 | ||||
| 	/// \return the number of items deleted. | ||||
| 	int removeByValue (const T& value) | ||||
|  | ||||
| @ -130,7 +130,7 @@ public: | ||||
| 	BinaryHeap (const SelfType& heap): ParentType (heap) {} | ||||
|  | ||||
| #if defined(QSE_CPP_ENABLE_CPP11_MOVE) | ||||
| 	BinaryHeap (SelfType&& heap): ParentType ((ParentType&&)heap) {} | ||||
| 	BinaryHeap (SelfType&& heap): ParentType (QSE_CPP_RVREF(heap)) {} | ||||
| #endif | ||||
|  | ||||
| 	~BinaryHeap () {} | ||||
| @ -149,7 +149,7 @@ public: | ||||
| 	{ | ||||
| 		if (this != &heap) | ||||
| 		{ | ||||
| 			ParentType::operator= ((ParentType&&)heap); | ||||
| 			ParentType::operator= (QSE_CPP_RVREF(heap)); | ||||
| 		} | ||||
| 		return *this; | ||||
| 	} | ||||
|  | ||||
| @ -199,14 +199,14 @@ public: | ||||
| 	WcString (Mmgr* mmgr, qse_wchar_t c, qse_size_t size): ParentType(mmgr, c, size) {} | ||||
| 	WcString (const WcString& str): ParentType(str) {} | ||||
| #if defined(QSE_CPP_ENABLE_CPP11_MOVE) | ||||
| 	WcString (WcString&& str): ParentType((ParentType&&)str) {} | ||||
| 	WcString (ParentType&& str): ParentType((ParentType&&)str) {} // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| 	WcString (WcString&& str): ParentType(QSE_CPP_RVREF(str)) {} | ||||
| 	WcString (ParentType&& str): ParentType(QSE_CPP_RVREF(str)) {} // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| #endif | ||||
|  | ||||
| 	WcString& operator= (const WcString& str) { ParentType::operator=(str); return *this; } | ||||
| #if defined(QSE_CPP_ENABLE_CPP11_MOVE) | ||||
| 	WcString& operator= (WcString&& str) { ParentType::operator=((WcString&&)str); return *this; } | ||||
| 	WcString& operator= (ParentType&& str) { ParentType::operator=((WcString&&)str); return *this; } // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| 	WcString& operator= (WcString&& str) { ParentType::operator=(QSE_CPP_RVREF(str)); return *this; } | ||||
| 	WcString& operator= (ParentType&& str) { ParentType::operator=(QSE_CPP_RVREF(str)); return *this; } // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| #endif | ||||
| 	WcString& operator= (const qse_wchar_t* str) { ParentType::operator=(str); return *this; } | ||||
| 	WcString& operator= (const qse_wchar_t c) { ParentType::operator=(c); return *this; } | ||||
| @ -237,15 +237,15 @@ public: | ||||
| 	MbString (const MbString& str): ParentType(str) {} | ||||
| 	MbString (const ParentType& str): ParentType(str) {} | ||||
| #if defined(QSE_CPP_ENABLE_CPP11_MOVE) | ||||
| 	MbString (MbString&& str): ParentType((ParentType&&)str) {} | ||||
| 	MbString (ParentType&& str): ParentType((ParentType&&)str) {} // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| 	MbString (MbString&& str): ParentType(QSE_CPP_RVREF(str)) {} | ||||
| 	MbString (ParentType&& str): ParentType(QSE_CPP_RVREF(str)) {} // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| #endif | ||||
|  | ||||
| 	MbString& operator= (const MbString& str) { ParentType::operator=(str); return *this; } | ||||
| 	MbString& operator= (const ParentType& str) { ParentType::operator=(str); return *this; } | ||||
| #if defined(QSE_CPP_ENABLE_CPP11_MOVE) | ||||
| 	MbString& operator= (MbString&& str) { ParentType::operator=((MbString&&)str); return *this; } | ||||
| 	MbString& operator= (ParentType&& str) { ParentType::operator=((MbString&&)str); return *this; } // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| 	MbString& operator= (MbString&& str) { ParentType::operator=(QSE_CPP_RVREF(str)); return *this; } | ||||
| 	MbString& operator= (ParentType&& str) { ParentType::operator=(QSE_CPP_RVREF(str)); return *this; } // added for ParentType returned in some methods defined in ParentType. e.g. getSubstring() | ||||
| #endif | ||||
| 	MbString& operator= (const qse_mchar_t* str) { ParentType::operator=(str); return *this; } | ||||
| 	MbString& operator= (const qse_mchar_t c) { ParentType::operator=(c); return *this; } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user