View Single Post
  #1   Spotlight this post!  
Unread 11-01-2017, 15:14
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 158
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
SendableChooser changes and errors

It appears that SendableChooser is now a template based class. Is there any documentation on how to use it?

We made some changes to use it as:
Code:
SendableChooser<int> *pChoice;
pChoice = new SendableChooser<int>();
And once instantiated and objects are added, wanted to check it via:
Code:
int ch = pChoice->GetSelected();
or
Code:
int ch = (int)pChoice->GetSelected();
Both have been unsuccessful. Errors from compilation are:
Code:
arm-frc-linux-gnueabi-g++ -std=c++1y -I/Users/rwolff/wpilib/cpp/current/include -I/Users/rwolff/dev/robotics/FRCTeam1967/code/NatSndChTestJig/src -I/Users/rwolff/dev/robotics/FRCTeam1967/code/include -I/Users/rwolff/wpilib/user/cpp/include -O0 -g3 -Wall -c -fmessage-length=0 -o src/Robot.o ../src/Robot.cpp 
In file included from /Users/rwolff/wpilib/cpp/current/include/SmartDashboard/SendableChooser.h:51:0,
                 from /Users/rwolff/wpilib/cpp/current/include/WPILib.h:72,
                 from ../src/Robot.cpp:1:
/Users/rwolff/wpilib/cpp/current/include/SmartDashboard/SendableChooser.inc: In instantiation of 'T frc::SendableChooser<T>::GetSelected() [with T = int]':
../src/Robot.cpp:38:42:   required from here
/Users/rwolff/wpilib/cpp/current/include/SmartDashboard/SendableChooser.inc:60:12: error: cannot convert 'std::nullptr_t' to 'int' in return
     return nullptr;
            ^
/Users/rwolff/wpilib/cpp/current/include/SmartDashboard/SendableChooser.inc: In member function 'T frc::SendableChooser<T>::GetSelected() [with T = int]':
I'm not sure if maybe it's only intended to be used with classes or class pointers and not something simple like an int possibly? Or if there's something more basic in err here.

Thanks!
roboBob
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote