#pragma once #include #include "util/range.h" namespace DHE { template class Selector { public: Selector(std::vector choices, std::function on_selection) : choices{std::move(choices)}, notify{std::move(on_selection)} {} /** * Send notice that the choice at the given position has been selected. */ void operator()(int position) { notify(choices[position]); } private: const std::vector choices; const std::function notify; }; } // namespace DHE