diff --git a/wpilibc/src/main/native/include/frc2/command/CommandScheduler.h b/wpilibc/src/main/native/include/frc2/command/CommandScheduler.h index ac6179d0b2..92dffc7d56 100644 --- a/wpilibc/src/main/native/include/frc2/command/CommandScheduler.h +++ b/wpilibc/src/main/native/include/frc2/command/CommandScheduler.h @@ -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 >::value>> + template >>> void SetDefaultCommand(Subsystem* subsystem, T&& defaultCommand) { if (!defaultCommand.HasRequirement(subsystem)) { wpi_setWPIErrorWithContext( diff --git a/wpilibc/src/main/native/include/frc2/command/ConditionalCommand.h b/wpilibc/src/main/native/include/frc2/command/ConditionalCommand.h index 01571861d7..0419cf97ec 100644 --- a/wpilibc/src/main/native/include/frc2/command/ConditionalCommand.h +++ b/wpilibc/src/main/native/include/frc2/command/ConditionalCommand.h @@ -46,9 +46,9 @@ class ConditionalCommand */ template >::value>, + std::is_base_of_v>>, typename = std::enable_if_t< - std::is_base_of>::value>> + std::is_base_of_v>>> ConditionalCommand(T1&& onTrue, T2&& onFalse, std::function condition) : ConditionalCommand(std::make_unique>( std::forward(onTrue)), diff --git a/wpilibc/src/main/native/include/frc2/command/ParallelDeadlineGroup.h b/wpilibc/src/main/native/include/frc2/command/ParallelDeadlineGroup.h index d76f033841..d453ab5f2e 100644 --- a/wpilibc/src/main/native/include/frc2/command/ParallelDeadlineGroup.h +++ b/wpilibc/src/main/native/include/frc2/command/ParallelDeadlineGroup.h @@ -51,7 +51,7 @@ class ParallelDeadlineGroup */ template >::value>, + std::is_base_of_v>>, typename = std::enable_if_t>...>>> explicit ParallelDeadlineGroup(T&& deadline, Types&&... commands) { diff --git a/wpilibc/src/main/native/include/frc2/command/PerpetualCommand.h b/wpilibc/src/main/native/include/frc2/command/PerpetualCommand.h index 7ed2dfc2b6..c5e8407207 100644 --- a/wpilibc/src/main/native/include/frc2/command/PerpetualCommand.h +++ b/wpilibc/src/main/native/include/frc2/command/PerpetualCommand.h @@ -43,8 +43,8 @@ class PerpetualCommand : public CommandHelper { * * @param command the command to run perpetually */ - template >::value>> + template >>> explicit PerpetualCommand(T&& command) : PerpetualCommand(std::make_unique>( std::forward(command))) {} diff --git a/wpilibc/src/main/native/include/frc2/command/Subsystem.h b/wpilibc/src/main/native/include/frc2/command/Subsystem.h index f549e64264..5eb10bc302 100644 --- a/wpilibc/src/main/native/include/frc2/command/Subsystem.h +++ b/wpilibc/src/main/native/include/frc2/command/Subsystem.h @@ -56,8 +56,8 @@ class Subsystem { * * @param defaultCommand the default command to associate with this subsystem */ - template >::value>> + template >>> void SetDefaultCommand(T&& defaultCommand) { CommandScheduler::GetInstance().SetDefaultCommand( this, std::forward(defaultCommand)); diff --git a/wpilibc/src/main/native/include/frc2/command/button/Button.h b/wpilibc/src/main/native/include/frc2/command/button/Button.h index dc4c54a837..3e0f7fe33d 100644 --- a/wpilibc/src/main/native/include/frc2/command/button/Button.h +++ b/wpilibc/src/main/native/include/frc2/command/button/Button.h @@ -54,8 +54,8 @@ class Button : public Trigger { * @param interruptible Whether the command should be interruptible. * @return The trigger, for chained calls. */ - template >::value>> + template >>> Button WhenPressed(T&& command, bool interruptible = true) { WhenActive(std::forward(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 >::value>> + template >>> Button WhileHeld(T&& command, bool interruptible = true) { WhileActiveContinous(std::forward(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 >::value>> + template >>> Button WhenHeld(T&& command, bool interruptible = true) { WhileActiveOnce(std::forward(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 >::value>> + template >>> Button WhenReleased(T&& command, bool interruptible = true) { WhenInactive(std::forward(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 >::value>> + template >>> Button ToggleWhenPressed(T&& command, bool interruptible = true) { ToggleWhenActive(std::forward(command), interruptible); return *this; diff --git a/wpilibc/src/main/native/include/frc2/command/button/Trigger.h b/wpilibc/src/main/native/include/frc2/command/button/Trigger.h index 30de38d394..1a65ff64c1 100644 --- a/wpilibc/src/main/native/include/frc2/command/button/Trigger.h +++ b/wpilibc/src/main/native/include/frc2/command/button/Trigger.h @@ -72,8 +72,8 @@ class Trigger { * @param interruptible Whether the command should be interruptible. * @return The trigger, for chained calls. */ - template >::value>> + template >>> 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 >::value>> + template >>> 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 >::value>> + template >>> 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 >::value>> + template >>> 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 >::value>> + template >>> Trigger ToggleWhenActive(T&& command, bool interruptible = true) { CommandScheduler::GetInstance().AddButton( [pressedLast = Get(), *this, diff --git a/wpilibc/src/test/native/cpp/frc2/command/make_vector.h b/wpilibc/src/test/native/cpp/frc2/command/make_vector.h index a15f5a8e5d..89d55b63cd 100644 --- a/wpilibc/src/test/native/cpp/frc2/command/make_vector.h +++ b/wpilibc/src/test/native/cpp/frc2/command/make_vector.h @@ -22,7 +22,7 @@ struct vec_type_helper { template struct vec_type_helper { - using type = typename std::common_type::type; + using type = typename std::common_type_t; }; template @@ -33,14 +33,12 @@ struct all_constructible_and_convertible : std::true_type {}; template struct all_constructible_and_convertible - : std::conditional::value && - std::is_convertible::value, - all_constructible_and_convertible, - std::false_type>::type {}; + : std::conditional_t< + std::is_constructible_v && std::is_convertible_v, + all_constructible_and_convertible, std::false_type> {}; template ::value, - int>::type = 0> + typename std::enable_if_t, int> = 0> std::vector make_vector_impl(Args&&... args) { std::vector vec; vec.reserve(sizeof...(Args)); @@ -50,19 +48,18 @@ std::vector make_vector_impl(Args&&... args) { } template ::value, - int>::type = 0> + typename std::enable_if_t, int> = 0> std::vector make_vector_impl(Args&&... args) { return std::vector{std::forward(args)...}; } } // namespace detail -template , - typename std::enable_if< - detail::all_constructible_and_convertible::value, - int>::type = 0> +template < + typename T = void, typename... Args, + typename V = detail::vec_type_helper_t, + typename std::enable_if_t< + detail::all_constructible_and_convertible::value, int> = 0> std::vector make_vector(Args&&... args) { return detail::make_vector_impl(std::forward(args)...); }