code format
This commit is contained in:
@@ -13,29 +13,29 @@
|
||||
//! Андрей Бычков work.a.b@yandex.ru;
|
||||
//! \~\}
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Stack container
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
PIP - Platform Independent Primitives
|
||||
Stack container
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PISTACK_H
|
||||
#define PISTACK_H
|
||||
|
||||
#include "pivector.h"
|
||||
#include "pideque.h"
|
||||
#include "pivector.h"
|
||||
|
||||
//! \addtogroup Containers
|
||||
//! \{
|
||||
@@ -53,18 +53,23 @@
|
||||
template<typename T>
|
||||
class PIStack: public PIVector<T> {
|
||||
public:
|
||||
|
||||
//! \~english Constructs an empty array.
|
||||
//! \~russian Создает пустой массив.
|
||||
PIStack() {}
|
||||
|
||||
//! \~english Puts an element on the stack.
|
||||
//! \~russian Кладёт элемент в стек.
|
||||
PIVector<T> & push(const T & v) {PIVector<T>::push_back(v); return *this;}
|
||||
PIVector<T> & push(const T & v) {
|
||||
PIVector<T>::push_back(v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Move an element on the stack.
|
||||
//! \~russian Перемещает элемент в стек.
|
||||
PIVector<T> & push(T && v) {PIVector<T>::push_back(std::move(v)); return *this;}
|
||||
PIVector<T> & push(T && v) {
|
||||
PIVector<T>::push_back(std::move(v));
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \~english Retrieves and returns an element from the stack.
|
||||
//! \~russian Забирает и возвращает элемент из стека.
|
||||
@@ -74,7 +79,7 @@ public:
|
||||
//! Otherwise will be undefined behavior.
|
||||
//! \~russian Эта функция предполагает, что массив не пустой.
|
||||
//! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти.
|
||||
T pop() {return PIVector<T>::take_back();}
|
||||
T pop() { return PIVector<T>::take_back(); }
|
||||
|
||||
//! \~english Top element of the stack
|
||||
//! \~russian Верхний элемент стека.
|
||||
@@ -86,16 +91,16 @@ public:
|
||||
//! \~russian Возвращает ссылку на верхний элемент стека.
|
||||
//! Эта функция предполагает, что массив не пустой.
|
||||
//! Иначе это приведёт к неопределённому поведению программы и ошибкам памяти.
|
||||
T & top() {return PIVector<T>::back();}
|
||||
const T & top() const {return PIVector<T>::back();}
|
||||
T & top() { return PIVector<T>::back(); }
|
||||
const T & top() const { return PIVector<T>::back(); }
|
||||
|
||||
//! \~english Converts \a PIStack to \a PIVector.
|
||||
//! \~russian Преобразует \a PIStack в \a PIVector.
|
||||
PIVector<T> toVector() const {return PIVector<T>(*this);}
|
||||
PIVector<T> toVector() const { return PIVector<T>(*this); }
|
||||
|
||||
//! \~english Converts \a PIStack to \a PIDeque.
|
||||
//! \~russian Преобразует \a PIStack в \a PIDeque.
|
||||
PIDeque<T> toDeque() const {return PIDeque<T>(PIVector<T>::data(), PIVector<T>::size());}
|
||||
PIDeque<T> toDeque() const { return PIDeque<T>(PIVector<T>::data(), PIVector<T>::size()); }
|
||||
};
|
||||
|
||||
#endif // PISTACK_H
|
||||
|
||||
Reference in New Issue
Block a user