|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Should we use std::unique_ptr?
When creating a new project and using "Robot C++ Project" (command-based), the example subsystem is declared as a std::unique_ptr rather than an old-style standard pointer:
Code:
static std::unique_ptr<ExampleSubsystem> examplesubsystem; Code:
ExampleSubsystem *examplesubsystem; That was great until we tried to use the subsystem as a Requires() parameter. Requires() only accepts a Subsystem *. You can get around that with unique_ptr's get() method but the result is a bit messy: Code:
Requires((Subsystem *)(examplesubsystem.get())); My questions are: - Should we be using std::unique_ptr like the example code is leading us to do? - Is FRC/WPILib moving towards using std::unique_ptr's? - Will they overload existing methods to accept both types of pointers (old and new)? Thanks in advance for any info you can provide. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|