mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
(cherry picked from commit 5b1a25489a545bddd66978a6b9a819742c5925d2)
This commit is contained in:
@@ -25,6 +25,16 @@ namespace BlackMisc
|
|||||||
|
|
||||||
class CPropertyIndexVariantMap;
|
class CPropertyIndexVariantMap;
|
||||||
|
|
||||||
|
// workaround GCC 4.7 bug
|
||||||
|
namespace Aviation { template <typename AVIO> class CModulator; }
|
||||||
|
namespace Private
|
||||||
|
{
|
||||||
|
template <typename T> struct is_default_constructible : std::is_default_constructible<T> {};
|
||||||
|
# if __GNUC__ == 4 && __GNUC_MINOR__ <= 7
|
||||||
|
template <typename T> struct is_default_constructible<Aviation::CModulator<T>> : std::false_type {};
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
namespace Mixin
|
namespace Mixin
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -66,14 +76,14 @@ namespace BlackMisc
|
|||||||
const Derived *derived() const { return static_cast<const Derived *>(this); }
|
const Derived *derived() const { return static_cast<const Derived *>(this); }
|
||||||
Derived *derived() { return static_cast<Derived *>(this); }
|
Derived *derived() { return static_cast<Derived *>(this); }
|
||||||
|
|
||||||
template <typename T, typename std::enable_if<std::is_default_constructible<T>::value, int>::type = 0>
|
template <typename T, typename std::enable_if<Private::is_default_constructible<T>::value, int>::type = 0>
|
||||||
CVariant myself() const { return CVariant::from(*derived()); }
|
CVariant myself() const { return CVariant::from(*derived()); }
|
||||||
template <typename T, typename std::enable_if<std::is_default_constructible<T>::value, int>::type = 0>
|
template <typename T, typename std::enable_if<Private::is_default_constructible<T>::value, int>::type = 0>
|
||||||
void myself(const CVariant &variant) { *derived() = variant.to<T>(); }
|
void myself(const CVariant &variant) { *derived() = variant.to<T>(); }
|
||||||
|
|
||||||
template <typename T, typename std::enable_if<! std::is_default_constructible<T>::value, int>::type = 0>
|
template <typename T, typename std::enable_if<! Private::is_default_constructible<T>::value, int>::type = 0>
|
||||||
CVariant myself() const { qFatal("isMyself should have been handled before reaching here"); return {}; }
|
CVariant myself() const { qFatal("isMyself should have been handled before reaching here"); return {}; }
|
||||||
template <typename T, typename std::enable_if<! std::is_default_constructible<T>::value, int>::type = 0>
|
template <typename T, typename std::enable_if<! Private::is_default_constructible<T>::value, int>::type = 0>
|
||||||
void myself(const CVariant &) { qFatal("isMyself should have been handled before reaching here"); }
|
void myself(const CVariant &) { qFatal("isMyself should have been handled before reaching here"); }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
Reference in New Issue
Block a user