diff --git a/expression.hpp b/expression.hpp index 722644b..5501ef0 100644 --- a/expression.hpp +++ b/expression.hpp @@ -290,6 +290,22 @@ namespace boost::proto17 { template using placeholder = expression>>; + // TODO: Test all the cases here. + + template + decltype(auto) deref (T && x) + { + if constexpr (detail::is_expr::value) { + if constexpr (detail::remove_cv_ref_t::kind == expr_kind::expr_ref) { + return ::boost::proto17::value(::boost::proto17::value(static_cast(x))); + } else { + return static_cast(x); + } + } else { + return static_cast(x); + } + } + template decltype(auto) value (Expr const & expr) {