Files
pilotclient/src/blackmisc/datastream.h
Mat Sutcliffe b80114213d Issue #77 Move mixin classes to separate files
By separating them from unrelated code, their dependents
can use them without depending on unrelated code, which
in turn helps to reduce cyclic dependencies.
2020-08-29 14:16:17 +01:00

36 lines
951 B
C++

/* Copyright (C) 2019
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
* or distributed except according to the terms contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISC_DATASTREAM_H
#define BLACKMISC_DATASTREAM_H
#include <QDataStream>
#include <utility>
/*!
* Operator for marshalling pairs with QDataStream.
*/
template <typename T, typename U>
QDataStream &operator <<(QDataStream &stream, const std::pair<T, U> &pair)
{
return stream << pair.first << pair.second;
}
/*!
* Operator for unmarshalling pairs with QDataStream.
*/
template <typename T, typename U>
QDataStream &operator >>(QDataStream &stream, std::pair<T, U> &pair)
{
return stream >> pair.first >> pair.second;
}
#endif