-
#include "tensorstore/util/result.h"
-
template <typename T>
auto tensorstore::ChainResult(T&& arg); -
template <typename T, typename Func0, typename... Func>
auto tensorstore::ChainResult(T&& arg, Func0&& func0, Func&&... func); Applies a sequence of functions, which may optionally return
Result
-wrapped values, to an optionallyResult
-wrapped value.For example:
float func1(int x); Result<std::string> func2(float x); bool func3(std::string_view x); Result<bool> y1 = ChainResult(Result<int>(3), func1, func2, func3); Result<bool> y2 = ChainResult(3, func1, func2, func3);