|
|
|
|
@ -387,24 +387,23 @@ template<class T, class K
|
|
|
|
|
* and you have to ensure that it's kept in scope for the whole |
|
|
|
|
* lifetime of the @ref Player instance. |
|
|
|
|
*/ |
|
|
|
|
#ifndef CORRADE_MSVC2019_COMPATIBILITY |
|
|
|
|
#ifndef CORRADE_MSVC_COMPATIBILITY |
|
|
|
|
template<class V, class R> Player<T, K>& add(const Track<K, V, R>& track, R& destination) { |
|
|
|
|
return add(TrackView<const K, const V, R>{track}, destination); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
/* MSVC 2015 and 2017 is clueless when it comes to trying to deduce the
|
|
|
|
|
template parameters (C2893: Failed to specialize function template). |
|
|
|
|
MSVC 2019 works with /permissive-, but I can neither detect presence |
|
|
|
|
of the flag nor force it onto users, so I'm treating it the same. |
|
|
|
|
It works when calling add<V, R> explicitly, but that makes the API |
|
|
|
|
hard to use and inconsistent between platforms. The only possible |
|
|
|
|
workaround is to make add() take *anything*, casting it to proper |
|
|
|
|
TrackView type and then calling add() with explicit template |
|
|
|
|
parameters. This also neatly resolves the Track/TrackView overload, |
|
|
|
|
as the static_cast is either a no-op or it invokes the conversion |
|
|
|
|
operator on Track. The original code also reportedly makes the |
|
|
|
|
Intellisense freezing like hell and adding this overload fixes the |
|
|
|
|
freezes. Three birds with one stone. */ |
|
|
|
|
MSVC 2019+ works with /permissive-. It works when calling add<V, R> |
|
|
|
|
explicitly, but that makes the API hard to use and inconsistent |
|
|
|
|
between platforms. The only possible workaround is to make add() |
|
|
|
|
take *anything*, casting it to proper TrackView type and then |
|
|
|
|
calling add() with explicit template parameters. This also neatly |
|
|
|
|
resolves the Track/TrackView overload, as the static_cast is either |
|
|
|
|
a no-op or it invokes the conversion operator on Track. The original |
|
|
|
|
code also reportedly makes the Intellisense freezing like hell and |
|
|
|
|
adding this overload fixes the freezes. Three birds with one |
|
|
|
|
stone. */ |
|
|
|
|
template<class Track, class R> Player<T, K>& add(const Track& track, R& destination) { |
|
|
|
|
return add<typename Track::ValueType, R>(static_cast<const TrackView<const K, const typename Track::ValueType, R>&>(track), destination); |
|
|
|
|
} |
|
|
|
|
@ -448,7 +447,7 @@ template<class T, class K
|
|
|
|
|
*/ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class V, class R> Player<T, K>& addWithCallback(const Track<K, V, R>& track, void(*callback)(K, const R&, void*), void* userData = nullptr); |
|
|
|
|
#elif !defined(CORRADE_MSVC2019_COMPATIBILITY) /* See above why */ |
|
|
|
|
#elif !defined(CORRADE_MSVC_COMPATIBILITY) /* See above why */ |
|
|
|
|
template<class V, class R, class Callback> Player<T, K>& addWithCallback(const Track<K, V, R>& track, Callback callback, void* userData = nullptr) { |
|
|
|
|
return addWithCallback(TrackView<const K, const V, R>{track}, callback, userData); |
|
|
|
|
} |
|
|
|
|
@ -487,7 +486,7 @@ template<class T, class K
|
|
|
|
|
*/ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class V, class R, class U> Player<T, K>& addWithCallback(const Track<K, V, R>& track, void(*callback)(K, const R&, U&), U& userData); |
|
|
|
|
#elif !defined(CORRADE_MSVC2019_COMPATIBILITY) /* See above why */ |
|
|
|
|
#elif !defined(CORRADE_MSVC_COMPATIBILITY) /* See above why */ |
|
|
|
|
template<class V, class R, class U, class Callback> Player<T, K>& addWithCallback(const Track<K, V, R>& track, Callback callback, U& userData) { |
|
|
|
|
return addWithCallback(TrackView<const K, const V, R>{track}, callback, userData); |
|
|
|
|
} |
|
|
|
|
@ -532,7 +531,7 @@ template<class T, class K
|
|
|
|
|
*/ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class V, class R> Player<T, K>& addWithCallbackOnChange(const Track<K, V, R>& track, void(*callback)(K, const R&, void*), R& destination, void* userData = nullptr); |
|
|
|
|
#elif !defined(CORRADE_MSVC2019_COMPATIBILITY) /* See above why */ |
|
|
|
|
#elif !defined(CORRADE_MSVC_COMPATIBILITY) /* See above why */ |
|
|
|
|
template<class V, class R, class Callback> Player<T, K>& addWithCallbackOnChange(const Track<K, V, R>& track, Callback callback, R& destination, void* userData = nullptr) { |
|
|
|
|
return addWithCallbackOnChange(TrackView<const K, const V, R>{track}, callback, destination, userData); |
|
|
|
|
} |
|
|
|
|
@ -571,7 +570,7 @@ template<class T, class K
|
|
|
|
|
*/ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class V, class R, class U> Player<T, K>& addWithCallbackOnChange(const Track<K, V, R>& track, void(*callback)(K, const R&, void*), R& destination, U& userData); |
|
|
|
|
#elif !defined(CORRADE_MSVC2019_COMPATIBILITY) /* See above why */ |
|
|
|
|
#elif !defined(CORRADE_MSVC_COMPATIBILITY) /* See above why */ |
|
|
|
|
template<class V, class R, class U, class Callback> Player<T, K>& addWithCallbackOnChange(const Track<K, V, R>& track, Callback callback, R& destination, U& userData) { |
|
|
|
|
return addWithCallbackOnChange(TrackView<const K, const V, R>{track}, callback, destination, userData); |
|
|
|
|
} |
|
|
|
|
@ -623,7 +622,7 @@ template<class T, class K
|
|
|
|
|
*/ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class V, class R> Player<T, K>& addRawCallback(const Track<K, V, R>& track, void(*callback)(const TrackViewStorage<const K>&, K, std::size_t&, void*, void(*)(), void*), void* destination, void(*userCallback)(), void* userData); |
|
|
|
|
#elif !defined(CORRADE_MSVC2019_COMPATIBILITY) /* See above why */ |
|
|
|
|
#elif !defined(CORRADE_MSVC_COMPATIBILITY) /* See above why */ |
|
|
|
|
template<class V, class R, class Callback> Player<T, K>& addRawCallback(const Track<K, V, R>& track, Callback callback, void* destination, void(*userCallback)(), void* userData) { |
|
|
|
|
return addRawCallback(TrackView<const K, const V, R>{track}, callback, destination, userCallback, userData); |
|
|
|
|
} |
|
|
|
|
|