View Single Post
  #4   Spotlight this post!  
Unread 17-01-2016, 23:38
heuristics heuristics is offline
Registered User
FRC #3634
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Trumbull, CT
Posts: 21
heuristics is on a distinguished road
Re: Shared pointers? Unique pointers?

The error message you're seeing tells me that you're not passing the correct type as a parameter to your function.
You still haven't posted the declaration of driveJoystick so I am assuming its type is shared_ptr<Joystick>. That should be fine.

It looks like you've changed the parameters of this function
Code:
void Chassis::SixDrive(Joystick driveStick);
This will not work since the Joystick class does not have a copy constructor.
Code:
Joystick (const Joystick &)=delete
You should change the function's parameter type back to shared_ptr<Joystick> and remove the (Joystick) cast where you're calling that function.

Alternatively, you could change your OI::getDriveJoystick() to this:

Code:
Joystick& OI::getDriveJoystick() {
   return *driveJoystick;
}
Then just always pass your Joystick around as a Joystick reference type (Joystick&). This will only work if you can guarantee that the Joystick object won't be deleted somewhere else while being used by the caller (which seems unlikely).

It would be much easier to diagnose if you could post compiler output and put all of your current code on pastebin or something.
Reply With Quote