[commands] Move SelectCommand factory impl to header (#4581)

It's templated, so it needs to be in the header.
This commit is contained in:
Starlight220
2022-11-08 01:49:36 +02:00
committed by GitHub
parent 323524fed6
commit 7d06e517e9
2 changed files with 6 additions and 10 deletions

View File

@@ -12,6 +12,7 @@
#include <vector>
#include "frc2/command/CommandPtr.h"
#include "frc2/command/SelectCommand.h"
namespace frc2 {
class Subsystem;
@@ -158,7 +159,11 @@ namespace cmd {
template <typename Key>
[[nodiscard]] CommandPtr Select(
std::function<Key()> selector,
std::vector<std::pair<Key, CommandPtr>> commands);
std::vector<std::pair<Key, CommandPtr>> commands) {
return SelectCommand(std::move(selector),
CommandPtr::UnwrapVector(std::move(commands)))
.ToPtr();
}
// Command Groups