Skip to content

Commit 5f1fbc2

Browse files
Fix the Menu::Item struct's constructor so that it's compatible with C++ versions previous to C++17
1 parent 6bad719 commit 5f1fbc2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cppmenu.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <string>
55
#include <vector>
66
#include <exception>
7+
#include <utility>
78

89
namespace CppMenu
910
{
@@ -22,6 +23,9 @@ namespace CppMenu
2223
std::string name{};
2324
std::function<void()> function{};
2425
bool haltOnDone{ true };
26+
27+
Item(std::string itemName, std::function<void()> itemFunction, bool shouldHaltOnDone = true)
28+
: name{std::move(itemName)}, function{std::move(itemFunction)}, haltOnDone{shouldHaltOnDone} {}
2529
};
2630

2731
friend void CppMenu::setMaxWidth(std::size_t width);

0 commit comments

Comments
 (0)