1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-25 10:36:36 +03:00

Use std::get_if

This commit is contained in:
Chuck 2019-09-16 09:04:28 -07:00 committed by Linus Heckemann
parent 88183eb484
commit c457766a1f

View file

@ -340,8 +340,8 @@ void printMultiLineString(Out & out, const Value & v)
void printValue(Context * ctx, Out & out, std::variant<Value, std::exception_ptr> maybe_value, const std::string & path) void printValue(Context * ctx, Out & out, std::variant<Value, std::exception_ptr> maybe_value, const std::string & path)
{ {
try { try {
if (std::holds_alternative<std::exception_ptr>(maybe_value)) { if (auto ex = std::get_if<std::exception_ptr>(&maybe_value)) {
std::rethrow_exception(std::get<std::exception_ptr>(maybe_value)); std::rethrow_exception(*ex);
} }
Value v = evaluateValue(ctx, &std::get<Value>(maybe_value)); Value v = evaluateValue(ctx, &std::get<Value>(maybe_value));
if (ctx->state->isDerivation(v)) { if (ctx->state->isDerivation(v)) {