3 ms·
GOOG is a big company, and not everyone handles this the same way. At least some teams are doing what the sibling mentioned: A static factory-like method that
by brandmeyer 10y ago
GOOG is a big company, and not everyone handles this the same way. At least some teams are doing what the sibling mentioned: A static factory-like method that returns a discriminated union of either T or an error type. It is conceptually similar to std::variant<T, std::error_condition>, but syntactically optimized for this use case.
- praptak 10y agoGoogle has StatusOr<T> for this purpose: https://github.com/google/protobuf/blob/master/src/google/protobuf/stubs/statusor.h https://github.com/google/protobuf/blob/master/src/google/pr...
- brandmeyer 10y agoYep, that's the one.
- deleted 10y ago[deleted]
- user5994461 10y agoI tried to imagine the error message given by this template when something is written wrong. Just had a vision of horror.