X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FTry-inl.h;h=801344d446553897736339df681763d180571669;hb=a578696f04cfa0bd609ea09323153de1aa67e446;hp=5517337cd1c45aa85dc1395c59f6270036d45ba1;hpb=1dd8e3878e8e3c3fa82e92f24eda677636200a04;p=folly.git diff --git a/folly/Try-inl.h b/folly/Try-inl.h index 5517337c..801344d4 100644 --- a/folly/Try-inl.h +++ b/folly/Try-inl.h @@ -1,5 +1,5 @@ /* - * Copyright 2017 Facebook, Inc. + * Copyright 2014-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,10 @@ #pragma once -#include +#include + #include +#include namespace folly { @@ -115,6 +117,12 @@ const T& Try::value() const & { return value_; } +template +const T&& Try::value() const && { + throwIfFailed(); + return std::move(value_); +} + template void Try::throwIfFailed() const { switch (contains_) { @@ -163,10 +171,31 @@ makeTryWith(F&& f) { } } -template -std::tuple unwrapTryTuple(std::tuple...>&& ts) { - return detail::TryTuple::unwrap( - std::forward...>>(ts)); +namespace try_detail { + +/** + * Trait that removes the layer of Try abstractions from the passed in type + */ +template +struct RemoveTry; +template