From 2dbc37866b1547e3c3c13041002de863b022ee97 Mon Sep 17 00:00:00 2001
From: namark <namark@disroot.org>
Date: Wed, 16 Dec 2020 03:57:00 +0400
Subject: [PATCH] Default constructed melody considered empty/done.

---
 source/simple/motion/melody.hpp | 7 +++++--
 unit_tests/melody.cpp           | 9 +++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/source/simple/motion/melody.hpp b/source/simple/motion/melody.hpp
index adeda2a..635a805 100644
--- a/source/simple/motion/melody.hpp
+++ b/source/simple/motion/melody.hpp
@@ -18,7 +18,10 @@ class melody
 	using result_t = multi_advance_result<duration>;
 
 	melody() = default;
-	melody(Motions... motions) : movements{motions...} {}
+	melody(Motions... motions) :
+		movements{motions...},
+		current_index{}
+	{}
 
 	bool done()
 	{
@@ -119,7 +122,7 @@ class melody
 	private:
 
 	std::tuple<Motions...> movements;
-	size_t current_index = 0;
+	size_t current_index = sizeof...(Motions);
 
 	template<typename F, size_t I = sizeof...(Motions) - 1>
 	void for_all(F&& f)
diff --git a/unit_tests/melody.cpp b/unit_tests/melody.cpp
index 1a9eade..88a764d 100644
--- a/unit_tests/melody.cpp
+++ b/unit_tests/melody.cpp
@@ -104,9 +104,18 @@ void Advance()
 
 }
 
+void EmptyIsDone()
+{
+	using movement = simple::motion::movement<std::chrono::milliseconds,float,float>;
+	using melody_t = melody<movement, movement>;
+	melody_t m;
+	assert(m.done());
+}
+
 int main()
 {
 	SharpTurn();
 	Advance();
+	EmptyIsDone();
 	return 0;
 }
-- 
GitLab