code format
This commit is contained in:
@@ -13,22 +13,22 @@
|
||||
//! Андрей Бычков work.a.b@yandex.ru;
|
||||
//! \~\}
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
pair
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
PIP - Platform Independent Primitives
|
||||
pair
|
||||
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 PIPAIR_H
|
||||
@@ -48,29 +48,28 @@
|
||||
template<typename Type0, typename Type1>
|
||||
class PIPair {
|
||||
public:
|
||||
|
||||
//! \~english Constructs an empty PIPair.
|
||||
//! \~russian Создает пустой PIPair.
|
||||
PIPair() : first(), second() {}
|
||||
PIPair(): first(), second() {}
|
||||
|
||||
//! \~english Constructs PIPair from [std::tuple](https://en.cppreference.com/w/cpp/utility/tuple).
|
||||
//! \~russian Создает PIPair из [std::tuple](https://ru.cppreference.com/w/cpp/utility/tuple).
|
||||
PIPair(std::tuple<Type0, Type1> tuple) {
|
||||
first = std::get<0>(tuple);
|
||||
first = std::get<0>(tuple);
|
||||
second = std::get<1>(tuple);
|
||||
}
|
||||
|
||||
//! \~english Constructs PIPair from values `value0` and `value1`.
|
||||
//! \~russian Создает PIPair из `value0` и `value1`.
|
||||
PIPair(const Type0 & value0, const Type1 & value1) {
|
||||
first = value0;
|
||||
first = value0;
|
||||
second = value1;
|
||||
}
|
||||
|
||||
//! \~english Move constructor.
|
||||
//! \~russian Перемещающий конструктор.
|
||||
PIPair(Type0 && value0, Type1 && value1) {
|
||||
first = std::move(value0);
|
||||
first = std::move(value0);
|
||||
second = std::move(value1);
|
||||
}
|
||||
|
||||
@@ -86,20 +85,20 @@ public:
|
||||
//! \~english Compare operator with PIPair.
|
||||
//! \~russian Оператор сравнения с PIPair.
|
||||
template<typename Type0, typename Type1>
|
||||
inline bool operator ==(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {
|
||||
inline bool operator==(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {
|
||||
return (value0.first == value1.first) && (value0.second == value1.second);
|
||||
}
|
||||
|
||||
//! \~english Compare operator with PIPair.
|
||||
//! \~russian Оператор сравнения с PIPair.
|
||||
template<typename Type0, typename Type1>
|
||||
inline bool operator !=(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {
|
||||
inline bool operator!=(const PIPair<Type0, Type1> & value0, const PIPair<Type0, Type1> & value1) {
|
||||
return (value0.first != value1.first) || (value0.second != value1.second);
|
||||
}
|
||||
|
||||
#ifdef PIP_STD_IOSTREAM
|
||||
template<typename Type0, typename Type1>
|
||||
inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> & v) {
|
||||
inline std::ostream & operator<<(std::ostream & s, const PIPair<Type0, Type1> & v) {
|
||||
s << "(" << v.first << ", " << v.second << ")";
|
||||
return s;
|
||||
}
|
||||
@@ -109,7 +108,7 @@ inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> &
|
||||
//! \~english Output operator to \a PICout
|
||||
//! \~russian Оператор вывода в \a PICout
|
||||
template<typename Type0, typename Type1>
|
||||
inline PICout operator <<(PICout s, const PIPair<Type0, Type1> & v) {
|
||||
inline PICout operator<<(PICout s, const PIPair<Type0, Type1> & v) {
|
||||
s.space();
|
||||
s.saveAndSetControls(0);
|
||||
s << "(" << v.first << ", " << v.second << ")";
|
||||
@@ -125,18 +124,18 @@ inline PICout operator <<(PICout s, const PIPair<Type0, Type1> & v) {
|
||||
//! auto p = createPIPair(1, 'a');
|
||||
//! piCout << p; // (1, a)
|
||||
//! \endcode
|
||||
template< class T1, class T2 >
|
||||
PIPair<T1,T2> createPIPair(const T1 & f, const T2 & s) {
|
||||
return PIPair<T1,T2>(f, s);
|
||||
template<class T1, class T2>
|
||||
PIPair<T1, T2> createPIPair(const T1 & f, const T2 & s) {
|
||||
return PIPair<T1, T2>(f, s);
|
||||
}
|
||||
|
||||
|
||||
//! \~english Creates \a PIPair object, deducing the target type from the types of arguments.
|
||||
//! \~russian Создает \a PIPair выводя типы из аргументов.
|
||||
//! \sa \a createPIPair()
|
||||
template< class T1, class T2 >
|
||||
PIPair<T1,T2> createPIPair(T1 && f, T2 && s) {
|
||||
return PIPair<T1,T2>(std::move(f), std::move(s));
|
||||
template<class T1, class T2>
|
||||
PIPair<T1, T2> createPIPair(T1 && f, T2 && s) {
|
||||
return PIPair<T1, T2>(std::move(f), std::move(s));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user