Replace ::value and ::type with _v and _t suffixes (#1885)

This commit is contained in:
Tyler Veness
2019-09-13 20:14:37 -07:00
committed by Peter Johnson
parent a5650b9439
commit 1d8c4d016f
8 changed files with 40 additions and 43 deletions

View File

@@ -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(

View File

@@ -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)),

View File

@@ -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) {

View File

@@ -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))) {}

View File

@@ -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));

View File

@@ -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;

View File

@@ -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,