Core/Flags: Move external operators to the global scope
Fixes usage of those operators outside of the Nz namespace, global scoping is not an issue thanks to the enable_if
This commit is contained in:
parent
1a677387d1
commit
7cc11245f9
|
|
@ -54,13 +54,13 @@ namespace Nz
|
||||||
private:
|
private:
|
||||||
BitField m_value;
|
BitField m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename E> constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator~(E lhs);
|
|
||||||
template<typename E> constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator|(E lhs, E rhs);
|
|
||||||
template<typename E> constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator&(E lhs, E rhs);
|
|
||||||
template<typename E> constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator^(E lhs, E rhs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename E> constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator~(E lhs);
|
||||||
|
template<typename E> constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator|(E lhs, E rhs);
|
||||||
|
template<typename E> constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator&(E lhs, E rhs);
|
||||||
|
template<typename E> constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator^(E lhs, E rhs);
|
||||||
|
|
||||||
#include <Nazara/Core/Flags.inl>
|
#include <Nazara/Core/Flags.inl>
|
||||||
|
|
||||||
#endif // NAZARA_FLAGS_HPP
|
#endif // NAZARA_FLAGS_HPP
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
return 1U << static_cast<BitField>(enumValue);
|
return 1U << static_cast<BitField>(enumValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Override binary NOT operator on enum to turns into a Flags object.
|
* \brief Override binary NOT operator on enum to turns into a Flags object.
|
||||||
|
|
@ -220,9 +220,9 @@ namespace Nz
|
||||||
* Returns a Flags object with all state enabled except for the enum one.
|
* Returns a Flags object with all state enabled except for the enum one.
|
||||||
*/
|
*/
|
||||||
template<typename E>
|
template<typename E>
|
||||||
constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator~(E lhs)
|
constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator~(E lhs)
|
||||||
{
|
{
|
||||||
return ~Flags<E>(lhs);
|
return ~Nz::Flags<E>(lhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -235,9 +235,9 @@ namespace Nz
|
||||||
* Returns a Flags object with combined states from the two enumeration values.
|
* Returns a Flags object with combined states from the two enumeration values.
|
||||||
*/
|
*/
|
||||||
template<typename E>
|
template<typename E>
|
||||||
constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator|(E lhs, E rhs)
|
constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator|(E lhs, E rhs)
|
||||||
{
|
{
|
||||||
return Flags<E>(lhs) | rhs;
|
return Nz::Flags<E>(lhs) | rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -251,9 +251,9 @@ namespace Nz
|
||||||
* In this case, only one flag will be enabled if both enumeration values are the same.
|
* In this case, only one flag will be enabled if both enumeration values are the same.
|
||||||
*/
|
*/
|
||||||
template<typename E>
|
template<typename E>
|
||||||
constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator&(E lhs, E rhs)
|
constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator&(E lhs, E rhs)
|
||||||
{
|
{
|
||||||
return Flags<E>(lhs) & rhs;
|
return Nz::Flags<E>(lhs) & rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -267,10 +267,9 @@ namespace Nz
|
||||||
* In this case, two flags will be enabled if both the enumeration values are different.
|
* In this case, two flags will be enabled if both the enumeration values are different.
|
||||||
*/
|
*/
|
||||||
template<typename E>
|
template<typename E>
|
||||||
constexpr std::enable_if_t<EnumAsFlags<E>::value, Flags<E>> operator^(E lhs, E rhs)
|
constexpr std::enable_if_t<Nz::EnumAsFlags<E>::value, Nz::Flags<E>> operator^(E lhs, E rhs)
|
||||||
{
|
{
|
||||||
return Flags<E>(lhs) ^ rhs;
|
return Nz::Flags<E>(lhs) ^ rhs;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Core/DebugOff.hpp>
|
#include <Nazara/Core/DebugOff.hpp>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue