Suppose i have something akin to this pseudocode:
std::optional<std::pair<double*, std::scope_lock<std::mutex> > > getDataTogetherWithLock() {
if (!some_ptr) {
return std::nullopt;
}
return some_ptr->getDataTogetherWithLock();//just returns std::pair<double*, std::scope_lock<std::mutex> >
}
This won't work, basicly if tried with real code will give an error about the return type cannot be converted to std::optional
.
What's the best way to solve this conundrum ?