mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Replace ::value and ::type with _v and _t suffixes (#1885)
This commit is contained in:
committed by
Peter Johnson
parent
a5650b9439
commit
1d8c4d016f
@@ -170,8 +170,8 @@ class CommandScheduler final : public frc::SendableBase, frc::ErrorBase {
|
||||
* @param subsystem the subsystem whose default command will be set
|
||||
* @param defaultCommand the default command to associate with the subsystem
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
void SetDefaultCommand(Subsystem* subsystem, T&& defaultCommand) {
|
||||
if (!defaultCommand.HasRequirement(subsystem)) {
|
||||
wpi_setWPIErrorWithContext(
|
||||
|
||||
@@ -46,9 +46,9 @@ class ConditionalCommand
|
||||
*/
|
||||
template <class T1, class T2,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of<Command, std::remove_reference_t<T1>>::value>,
|
||||
std::is_base_of_v<Command, std::remove_reference_t<T1>>>,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of<Command, std::remove_reference_t<T2>>::value>>
|
||||
std::is_base_of_v<Command, std::remove_reference_t<T2>>>>
|
||||
ConditionalCommand(T1&& onTrue, T2&& onFalse, std::function<bool()> condition)
|
||||
: ConditionalCommand(std::make_unique<std::remove_reference_t<T1>>(
|
||||
std::forward<T1>(onTrue)),
|
||||
|
||||
@@ -51,7 +51,7 @@ class ParallelDeadlineGroup
|
||||
*/
|
||||
template <class T, class... Types,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of<Command, std::remove_reference_t<T>>::value>,
|
||||
std::is_base_of_v<Command, std::remove_reference_t<T>>>,
|
||||
typename = std::enable_if_t<std::conjunction_v<
|
||||
std::is_base_of<Command, std::remove_reference_t<Types>>...>>>
|
||||
explicit ParallelDeadlineGroup(T&& deadline, Types&&... commands) {
|
||||
|
||||
@@ -43,8 +43,8 @@ class PerpetualCommand : public CommandHelper<CommandBase, PerpetualCommand> {
|
||||
*
|
||||
* @param command the command to run perpetually
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
explicit PerpetualCommand(T&& command)
|
||||
: PerpetualCommand(std::make_unique<std::remove_reference_t<T>>(
|
||||
std::forward<T>(command))) {}
|
||||
|
||||
@@ -56,8 +56,8 @@ class Subsystem {
|
||||
*
|
||||
* @param defaultCommand the default command to associate with this subsystem
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
void SetDefaultCommand(T&& defaultCommand) {
|
||||
CommandScheduler::GetInstance().SetDefaultCommand(
|
||||
this, std::forward<T>(defaultCommand));
|
||||
|
||||
@@ -54,8 +54,8 @@ class Button : public Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The trigger, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Button WhenPressed(T&& command, bool interruptible = true) {
|
||||
WhenActive(std::forward<T>(command), interruptible);
|
||||
return *this;
|
||||
@@ -89,8 +89,8 @@ class Button : public Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The button, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Button WhileHeld(T&& command, bool interruptible = true) {
|
||||
WhileActiveContinous(std::forward<T>(command), interruptible);
|
||||
return *this;
|
||||
@@ -124,8 +124,8 @@ class Button : public Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The button, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Button WhenHeld(T&& command, bool interruptible = true) {
|
||||
WhileActiveOnce(std::forward<T>(command), interruptible);
|
||||
return *this;
|
||||
@@ -152,8 +152,8 @@ class Button : public Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The button, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Button WhenReleased(T&& command, bool interruptible = true) {
|
||||
WhenInactive(std::forward<T>(command), interruptible);
|
||||
return *this;
|
||||
@@ -187,8 +187,8 @@ class Button : public Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The button, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Button ToggleWhenPressed(T&& command, bool interruptible = true) {
|
||||
ToggleWhenActive(std::forward<T>(command), interruptible);
|
||||
return *this;
|
||||
|
||||
@@ -72,8 +72,8 @@ class Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The trigger, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Trigger WhenActive(T&& command, bool interruptible = true) {
|
||||
CommandScheduler::GetInstance().AddButton(
|
||||
[pressedLast = Get(), *this,
|
||||
@@ -120,8 +120,8 @@ class Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The trigger, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Trigger WhileActiveContinous(T&& command, bool interruptible = true) {
|
||||
CommandScheduler::GetInstance().AddButton(
|
||||
[pressedLast = Get(), *this,
|
||||
@@ -169,8 +169,8 @@ class Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The trigger, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Trigger WhileActiveOnce(T&& command, bool interruptible = true) {
|
||||
CommandScheduler::GetInstance().AddButton(
|
||||
[pressedLast = Get(), *this,
|
||||
@@ -211,8 +211,8 @@ class Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The trigger, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Trigger WhenInactive(T&& command, bool interruptible = true) {
|
||||
CommandScheduler::GetInstance().AddButton(
|
||||
[pressedLast = Get(), *this,
|
||||
@@ -258,8 +258,8 @@ class Trigger {
|
||||
* @param interruptible Whether the command should be interruptible.
|
||||
* @return The trigger, for chained calls.
|
||||
*/
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of<
|
||||
Command, std::remove_reference_t<T>>::value>>
|
||||
template <class T, typename = std::enable_if_t<std::is_base_of_v<
|
||||
Command, std::remove_reference_t<T>>>>
|
||||
Trigger ToggleWhenActive(T&& command, bool interruptible = true) {
|
||||
CommandScheduler::GetInstance().AddButton(
|
||||
[pressedLast = Get(), *this,
|
||||
|
||||
Reference in New Issue
Block a user