mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpilibc] Return reference from GetInstance (#3247)
Improves consistency across all classes. Affects Preferences, LiveWindow, and CameraServer. Old commands Scheduler::GetInstance() was not updated as this is already deprecated.
This commit is contained in:
@@ -45,7 +45,7 @@ struct CameraServer::Impl {
|
||||
std::vector<std::string> m_addresses;
|
||||
};
|
||||
|
||||
CameraServer* CameraServer::GetInstance() {
|
||||
CameraServer& CameraServer::GetInstance() {
|
||||
struct Creator {
|
||||
static void* call() { return new CameraServer{}; }
|
||||
};
|
||||
@@ -53,7 +53,7 @@ CameraServer* CameraServer::GetInstance() {
|
||||
static void call(void* ptr) { delete static_cast<CameraServer*>(ptr); }
|
||||
};
|
||||
static wpi::ManagedStatic<CameraServer, Creator, Deleter> instance;
|
||||
return &(*instance);
|
||||
return *instance;
|
||||
}
|
||||
|
||||
static wpi::StringRef MakeSourceValue(CS_Source source,
|
||||
|
||||
Reference in New Issue
Block a user