Browse Source

Animation: explicitly mark Track move construction/assignment as noexcept.

Interestingly enough, GCC reported these were noexcept even without that
annotation.

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
pull/521/head
Vladimír Vondruš 5 years ago
parent
commit
ef77fac659
  1. 20
      src/Magnum/Animation/Test/TrackTest.cpp
  2. 4
      src/Magnum/Animation/Track.h

20
src/Magnum/Animation/Test/TrackTest.cpp

@ -48,6 +48,9 @@ struct TrackTest: TestSuite::Tester {
void constructInitializerListInterpolationInterpolator();
void constructInitializerListInterpolationInterpolatorDefaults();
void constructCopy();
void constructMove();
void convertView();
void at();
@ -106,6 +109,9 @@ TrackTest::TrackTest() {
&TrackTest::constructInitializerListInterpolationInterpolator,
&TrackTest::constructInitializerListInterpolationInterpolatorDefaults,
&TrackTest::constructCopy,
&TrackTest::constructMove,
&TrackTest::convertView});
addInstancedTests({&TrackTest::at,
@ -389,6 +395,20 @@ void TrackTest::constructInitializerListInterpolationInterpolatorDefaults() {
CORRADE_COMPARE(a.values()[0], (Vector3{3.0f, 1.0f, 0.1f}));
}
void TrackTest::constructCopy() {
CORRADE_VERIFY(!std::is_copy_constructible<Track<Float, Vector3>>::value);
CORRADE_VERIFY(!std::is_copy_assignable<Track<Float, Vector3>>::value);
}
void TrackTest::constructMove() {
/* The move is defaulted, so verify just the right attributes */
CORRADE_VERIFY(std::is_nothrow_move_constructible<Track<Float, Vector3>>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Track<Float, Vector3>>::value);
CORRADE_VERIFY(std::is_nothrow_move_constructible<Track<Float, Vector3>>::value);
CORRADE_VERIFY(std::is_nothrow_move_assignable<Track<Float, Vector3>>::value);
}
void TrackTest::convertView() {
Track<Float, Vector3> a{
{{1.0f, {3.0f, 1.0f, 0.1f}},

4
src/Magnum/Animation/Track.h

@ -234,13 +234,13 @@ template<class K, class V, class R
Track(const Track<K, V, R>&) = delete;
/** @brief Move constructor */
Track(Track<K, V, R>&&) = default;
Track(Track<K, V, R>&&) noexcept = default;
/** @brief Copying is not allowed */
Track<K, V, R>& operator=(const Track<K, V, R>&) = delete;
/** @brief Move constructor */
Track<K, V, R>& operator=(Track<K, V, R>&&) = default;
Track<K, V, R>& operator=(Track<K, V, R>&&) noexcept = default;
/** @brief Conversion to a view */
operator TrackView<const K, const V, R>() const noexcept {

Loading…
Cancel
Save