mirror of
https://github.com/xfarrow/lasd.git
synced 2025-06-05 21:49:14 +02:00
Library 2
This commit is contained in:
@ -3,82 +3,87 @@ namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
template <typename Data>
|
||||
QueueLst(const LinearContainer<Data>& linear){
|
||||
QueueLst<Data>::QueueLst(const LinearContainer<Data>& linear){
|
||||
for(ulong i=0; i<linear.Size() ; ++i){
|
||||
Enqueue(linear[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
QueueLst(const QueueLst& copyFrom){
|
||||
QueueLst<Data>::QueueLst(const QueueLst& copyFrom){
|
||||
for(ulong i=0; i<copyFrom.Size() ; ++i){
|
||||
Enqueue(copyFrom[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
QueueLst(QueueLst&& moveFrom) noexcept{
|
||||
QueueLst<Data>::QueueLst(QueueLst&& moveFrom) noexcept{
|
||||
std::swap(head,moveFrom.head);
|
||||
std::swap(tail,moveFrom.tail);
|
||||
std::swap(size,moveFrom.size);
|
||||
}
|
||||
|
||||
~QueueLst(){
|
||||
template <typename Data>
|
||||
QueueLst<Data>::~QueueLst(){
|
||||
Clear();
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
QueueLst<Data>& operator=(const QueueLst& toCopy){
|
||||
QueueLst<Data>* tmp = new QueueLst<Data>(toCopy);
|
||||
std::swap(*this, *tmp);
|
||||
delete tmp;
|
||||
QueueLst<Data>& QueueLst<Data>::operator=(const QueueLst& toCopy){
|
||||
// QueueLst<Data>* tmp = new QueueLst<Data>(toCopy);
|
||||
// std::swap(*this, *tmp);
|
||||
// delete tmp;
|
||||
// return *this;
|
||||
|
||||
List<Data>::operator=(toCopy);
|
||||
return *this;
|
||||
/*
|
||||
List<Data>::operator=(copyFrom);
|
||||
*/
|
||||
}
|
||||
|
||||
QueueLst& operator=(QueueLst&& toMove) noexcept{
|
||||
if(*this != toMove){
|
||||
std::swap(head, toMove.head);
|
||||
std::swap(head, toMove.tail);
|
||||
std::swap(size, toMove.size);
|
||||
return *this;
|
||||
}
|
||||
template <typename Data>
|
||||
QueueLst<Data>& QueueLst<Data>::operator=(QueueLst&& toMove) noexcept{
|
||||
List<Data>::operator=(std::move(toMove));
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const QueueLst& queuelist) const noexcept{
|
||||
template <typename Data>
|
||||
bool QueueLst<Data>::operator==(const QueueLst& queuelist) const noexcept{
|
||||
return List<Data>::operator==(queuelist);
|
||||
}
|
||||
|
||||
bool operator==(const QueueLst& queuelist) const noexcept{
|
||||
template <typename Data>
|
||||
bool QueueLst<Data>::operator!=(const QueueLst& queuelist) const noexcept{
|
||||
return List<Data>::operator!=(queuelist);
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
void Enqueue(const Data& data){
|
||||
void QueueLst<Data>::Enqueue(const Data& data){
|
||||
List<Data>::InsertAtBack(data);
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
void Enqueue(Data&& data){
|
||||
void QueueLst<Data>::Enqueue(Data&& data){
|
||||
List<Data>::InsertAtBack(data);
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
Data& Head() const{
|
||||
Data& QueueLst<Data>::Head() const{
|
||||
return List<Data>::Front();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
void Dequeue(){
|
||||
void QueueLst<Data>::Dequeue(){
|
||||
List<Data>::RemoveFromFront();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
Data HeadNDequeue(){
|
||||
Data QueueLst<Data>::HeadNDequeue(){
|
||||
return List<Data>::FrontNRemove();
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
void QueueLst<Data>::Clear(){
|
||||
List<Data>::Clear();
|
||||
}
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user