PIPair doc

This commit is contained in:
Andrey
2022-04-22 19:20:50 +03:00
parent 416b142889
commit 91216c4b17

View File

@@ -41,7 +41,7 @@
//! \{ //! \{
//! \class PIPair //! \class PIPair
//! \brief //! \brief
//! \~english //! \~english Class template that provides a way to store two heterogeneous objects as a single unit.
//! \~russian Класс, который позволяет хранить два разнородных объекта как единое целое. //! \~russian Класс, который позволяет хранить два разнородных объекта как единое целое.
//! \~\} //! \~\}
//! \details //! \details
@@ -51,21 +51,34 @@
template<typename Type0, typename Type1> template<typename Type0, typename Type1>
class PIPair { class PIPair {
public: 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) { PIPair(std::tuple<Type0, Type1> tuple) {
first = std::get<0>(tuple); first = std::get<0>(tuple);
second = std::get<1>(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) { PIPair(const Type0 & value0, const Type1 & value1) {
first = value0; first = value0;
second = value1; second = value1;
} }
//! \~english Move constructor.
//! \~russian Перемещающий конструктор.
PIPair(Type0 && value0, Type1 && value1) { PIPair(Type0 && value0, Type1 && value1) {
first = std::move(value0); first = std::move(value0);
second = std::move(value1); second = std::move(value1);
} }
Type0 first;
Type1 second; Type0 first /*! \~english First element \~russian Первый элемент */;
Type1 second /*! \~english Second element \~russian Второй элемент */;
}; };
//! \~english Compare operator with PIPair. //! \~english Compare operator with PIPair.
@@ -90,6 +103,9 @@ inline std::ostream & operator <<(std::ostream & s, const PIPair<Type0, Type1> &
} }
#endif #endif
//! \relatesalso PICout
//! \~english Output operator to \a PICout
//! \~russian Оператор вывода в \a PICout
template<typename Type0, typename Type1> 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.space();