Closed glebm closed 3 years ago
The underlying API and the querying method both accept char *
, so this would just be an unnecessary conversion, no?
The underlying API is C, the API we provide is C++, so std::string
makes the most sense here. If this was anything where performance matters, we would instead provide an overload for const char*
as well. But it's just the init()
functions. It's not gonna get called in a tight loop or anything :)
Fair enough
what's a nullptr string?
what's a nullptr string?
There is none, but just use an empty string in those cases. So:
const std::string& device = {}
Then check if it's empty of course and pass nullptr
to SDL if it is.
I guess this assumes we can never have an empty string device name?
oh well, could also be an std::optional<std::string>
but that's not available in GCC 6 (well there is std::experimental::optional
)
Done
I'm not aware that it's possible for a device name to be empty. Could be wrong of course, but that would be rather weird?
Yeah probably not a use case that's super important to support even if it does happen
Let's just use
const std::string&
for this instead ofchar*
.