mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
refs #662 Work around MSVC2015 bug causing failure to detect getLogCategories() in some conditions.
This commit is contained in:
@@ -46,6 +46,21 @@ namespace BlackMisc
|
||||
struct HasToQString<T, void_t<decltype(std::declval<T>().toQString())>> : public std::true_type {};
|
||||
//! \endcond
|
||||
|
||||
#ifdef Q_CC_MSVC // work around what seems to be an expression SFINAE bug in MSVC
|
||||
namespace Private
|
||||
{
|
||||
struct HasGetLogCategoriesHelper
|
||||
{
|
||||
struct Base { int getLogCategories; };
|
||||
template <typename T> struct Derived : public T, public Base {};
|
||||
template <typename T, T> struct TypeCheck {};
|
||||
template <typename T> static std::false_type test(TypeCheck<decltype(&Base::getLogCategories), &Derived<T>::getLogCategories> *);
|
||||
template <typename T> static std::true_type test(...);
|
||||
};
|
||||
}
|
||||
template <typename T>
|
||||
using HasGetLogCategories = decltype(Private::HasGetLogCategoriesHelper::test<T>(nullptr));
|
||||
#else
|
||||
/*!
|
||||
* Trait to detect whether a class T has a static member function named getLogCategories.
|
||||
*/
|
||||
@@ -55,6 +70,7 @@ namespace BlackMisc
|
||||
template <typename T>
|
||||
struct HasGetLogCategories<T, void_t<decltype(T::getLogCategories())>> : public std::true_type {};
|
||||
//! \endcond
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Trait to detect whether a class T can be used as a key in a QHash.
|
||||
|
||||
Reference in New Issue
Block a user