refs #184 , moved template into global namespace, see https://dev.vatsim-germany.org/issues/184#note-2

This commit is contained in:
Klaus Basan
2014-03-14 01:50:33 +01:00
parent cf10f9cc35
commit a38385e6e6

View File

@@ -11,6 +11,24 @@
#include <type_traits>
#include <iostream>
/*!
* Non-member non-friend operator for streaming enums to QDBusArgument.
*
* \param argument
* \param enumType
* \return
* \remarks Currently outside namespace for OSX build, see https://dev.vatsim-germany.org/issues/184
*/
template <class ENUM> typename std::enable_if<std::is_enum<ENUM>::value, QDBusArgument>::type const &
operator>>(const QDBusArgument &argument, ENUM &enumType)
{
uint e;
argument >> e;
enumType = static_cast<ENUM>(e);
return argument;
}
namespace BlackMisc
{
// forward declaration
@@ -297,22 +315,6 @@ namespace BlackMisc
return argument >> static_cast<CValueObject &>(valueObject);
}
/*!
* Non-member non-friend operator for streaming enums to QDBusArgument.
*
* \param argument
* \param enumType
* \return
*/
template <class ENUM> typename std::enable_if<std::is_enum<ENUM>::value, QDBusArgument>::type const &
operator>>(const QDBusArgument &argument, ENUM &enumType)
{
uint e;
argument>> e;
enumType = static_cast<ENUM>(e);
return argument;
}
/*!
* Non-member non-friend operator for streaming T objects from QDBusArgument.
* Needed because we can't rely on the friend operator in some cases due to