Refactoring.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-07-01 18:24:46 +03:00
parent efa1bc6f27
commit 9042cd000c

View File

@ -38,17 +38,16 @@
//it stores the enum in a qint64 //it stores the enum in a qint64
template<typename Enum, template<typename Enum,
typename = typename std::enable_if<std::is_enum<Enum>::value>::type> typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
QDataStream& operator<<(QDataStream& stream, const Enum& e) inline QDataStream& operator<<(QDataStream& stream, const Enum& e)
{ {
stream << static_cast<qint64>(e); return stream << static_cast<qint64>(e);
return stream;
} }
//a function that can deserialize any enum from QDataStream //a function that can deserialize any enum from QDataStream
//it reads the enum as if it was stored in qint64 //it reads the enum as if it was stored in qint64
template<typename Enum, template<typename Enum,
typename = typename std::enable_if<std::is_enum<Enum>::value>::type> typename = typename std::enable_if<std::is_enum<Enum>::value>::type>
QDataStream& operator>>(QDataStream& stream, Enum& e) inline QDataStream& operator>>(QDataStream& stream, Enum& e)
{ {
qint64 v; qint64 v;
stream >> v; stream >> v;