-
#include "tensorstore/util/result.h"
- TENSORSTORE_CHECK_OK_AND_ASSIGN(decl, ...);
Convenience macro for checking errors when calling a function that returns a
tensorstore::Result
.This macro generates multiple statements and should be invoked as follows:
Result<int> GetSomeResult(); TENSORSTORE_CHECK_OK_AND_ASSIGN(int x, GetSomeResult());
If the expression returns a
tensorstore::Result
with a value, the value is assigned todecl
. Otherwise, the error is logged and the program is terminated.