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