From a5c5f914d93e6ce4a31a55992899309b06b00969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 8 Apr 2023 19:30:15 +0200 Subject: [PATCH] Animation: store a void StridedArrayView in TrackViewStorage. This way we don't need to do any crazy casts anymore, only for the interpolator function pointer (where it's fine I guess). --- src/Magnum/Animation/Track.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Magnum/Animation/Track.h b/src/Magnum/Animation/Track.h index eda078250..32db6a06e 100644 --- a/src/Magnum/Animation/Track.h +++ b/src/Magnum/Animation/Track.h @@ -512,17 +512,17 @@ template class TrackViewStorage { * @ref Corrade::Containers::arrayCast(). * @see @ref keys(), @ref TrackView::operator[]() */ - Containers::StridedArrayView1D::value, const char, char>::type> values() const { + Containers::StridedArrayView1D::value, const void, void>::type> values() const { return _values; } private: template friend class TrackView; - template explicit TrackViewStorage(const Containers::StridedArrayView1D& keys, const Containers::StridedArrayView1D& values, Interpolation interpolation, R(*interpolator)(const typename std::remove_const::type&, const typename std::remove_const::type&, Float), Extrapolation before, Extrapolation after) noexcept: _keys{keys}, _values{reinterpret_cast&>(values)}, _interpolator{reinterpret_cast(interpolator)}, _interpolation{interpolation}, _before{before}, _after{after} {} + template explicit TrackViewStorage(const Containers::StridedArrayView1D& keys, const Containers::StridedArrayView1D::value, const void, void>::type>& values, Interpolation interpolation, R(*interpolator)(const V&, const V&, Float), Extrapolation before, Extrapolation after) noexcept: _keys{keys}, _values{values}, _interpolator{reinterpret_cast(interpolator)}, _interpolation{interpolation}, _before{before}, _after{after} {} Containers::StridedArrayView1D _keys; - Containers::StridedArrayView1D::value, const char, char>::type> _values; + Containers::StridedArrayView1D::value, const void, void>::type> _values; void(*_interpolator)(); Interpolation _interpolation; Extrapolation _before, _after; @@ -716,7 +716,7 @@ template::value && std::is_same::value>::type> /*implicit*/ TrackView(const TrackView& other) noexcept: TrackViewStorage{other._keys, reinterpret_cast&>(other._values), other._interpolation, reinterpret_cast(other._interpolator), other._before, other._after} {} + template::value && std::is_same::value>::type> /*implicit*/ TrackView(const TrackView& other) noexcept: TrackViewStorage{other._keys, other._values, other._interpolation, reinterpret_cast(other._interpolator), other._before, other._after} {} /** * @brief Interpolation function