With regards to the paper which describes removing the void specializations for std::future and std::promise P0241R0. This may be a stupid question but the proposed solution is to remove the void specialization entirely, but then what are people expected to do when they want to instantiate a std::future<void>
object?
As noted in the reference, this would be possible if void
were a regular type.
void get_value() {
void x;
return x;
}
This is the way it works in some other languages, so it's not without precedent. In other languages it's called the "unit" type, because it has exactly one possible value. (Other languages also have the "null" type, which has no possible values, so if you try to create one you get an error. It's named "null" but it's unrelated to null pointers.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With