update boost
This commit is contained in:
@@ -23,7 +23,7 @@ namespace boost { namespace yap {
|
||||
template<typename Expr, bool MutableRvalueRef>
|
||||
struct deref_impl
|
||||
{
|
||||
decltype(auto) operator()(Expr && expr)
|
||||
constexpr decltype(auto) operator()(Expr && expr)
|
||||
{
|
||||
return std::move(*expr.elements[hana::llong_c<0>]);
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace boost { namespace yap {
|
||||
template<typename Expr>
|
||||
struct deref_impl<Expr, false>
|
||||
{
|
||||
decltype(auto) operator()(Expr && expr)
|
||||
constexpr decltype(auto) operator()(Expr && expr)
|
||||
{
|
||||
return *expr.elements[hana::llong_c<0>];
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace boost { namespace yap {
|
||||
/** "Dereferences" a reference-expression, forwarding its referent to
|
||||
the caller. */
|
||||
template<typename Expr>
|
||||
decltype(auto) deref(Expr && expr)
|
||||
constexpr decltype(auto) deref(Expr && expr)
|
||||
{
|
||||
static_assert(
|
||||
is_expr<Expr>::value, "deref() is only defined for expressions.");
|
||||
@@ -82,7 +82,7 @@ namespace boost { namespace yap {
|
||||
#ifdef BOOST_NO_CONSTEXPR_IF
|
||||
|
||||
template<bool ValueOfTerminalsOnly, typename T>
|
||||
decltype(auto) value_impl(T && x);
|
||||
constexpr decltype(auto) value_impl(T && x);
|
||||
|
||||
template<
|
||||
typename T,
|
||||
@@ -104,7 +104,7 @@ namespace boost { namespace yap {
|
||||
TakeValue,
|
||||
IsLvalueRef>
|
||||
{
|
||||
decltype(auto) operator()(T && x)
|
||||
constexpr decltype(auto) operator()(T && x)
|
||||
{
|
||||
return ::boost::yap::detail::value_impl<ValueOfTerminalsOnly>(
|
||||
::boost::yap::deref(static_cast<T &&>(x)));
|
||||
@@ -114,7 +114,7 @@ namespace boost { namespace yap {
|
||||
template<typename T, bool ValueOfTerminalsOnly>
|
||||
struct value_expr_impl<T, false, ValueOfTerminalsOnly, true, true>
|
||||
{
|
||||
decltype(auto) operator()(T && x)
|
||||
constexpr decltype(auto) operator()(T && x)
|
||||
{
|
||||
return x.elements[hana::llong_c<0>];
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace boost { namespace yap {
|
||||
template<typename T, bool ValueOfTerminalsOnly>
|
||||
struct value_expr_impl<T, false, ValueOfTerminalsOnly, true, false>
|
||||
{
|
||||
decltype(auto) operator()(T && x)
|
||||
constexpr decltype(auto) operator()(T && x)
|
||||
{
|
||||
return std::move(x.elements[hana::llong_c<0>]);
|
||||
}
|
||||
@@ -137,13 +137,16 @@ namespace boost { namespace yap {
|
||||
false,
|
||||
IsLvalueRef>
|
||||
{
|
||||
decltype(auto) operator()(T && x) { return static_cast<T &&>(x); }
|
||||
constexpr decltype(auto) operator()(T && x)
|
||||
{
|
||||
return static_cast<T &&>(x);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, bool IsExpr, bool ValueOfTerminalsOnly>
|
||||
struct value_impl_t
|
||||
{
|
||||
decltype(auto) operator()(T && x)
|
||||
constexpr decltype(auto) operator()(T && x)
|
||||
{
|
||||
constexpr expr_kind kind = detail::remove_cv_ref_t<T>::kind;
|
||||
constexpr detail::expr_arity arity = detail::arity_of<kind>();
|
||||
@@ -162,11 +165,14 @@ namespace boost { namespace yap {
|
||||
template<typename T, bool ValueOfTerminalsOnly>
|
||||
struct value_impl_t<T, false, ValueOfTerminalsOnly>
|
||||
{
|
||||
decltype(auto) operator()(T && x) { return static_cast<T &&>(x); }
|
||||
constexpr decltype(auto) operator()(T && x)
|
||||
{
|
||||
return static_cast<T &&>(x);
|
||||
}
|
||||
};
|
||||
|
||||
template<bool ValueOfTerminalsOnly, typename T>
|
||||
decltype(auto) value_impl(T && x)
|
||||
constexpr decltype(auto) value_impl(T && x)
|
||||
{
|
||||
return detail::
|
||||
value_impl_t<T, is_expr<T>::value, ValueOfTerminalsOnly>{}(
|
||||
@@ -176,7 +182,7 @@ namespace boost { namespace yap {
|
||||
#else
|
||||
|
||||
template<bool ValueOfTerminalsOnly, typename T>
|
||||
decltype(auto) value_impl(T && x)
|
||||
constexpr decltype(auto) value_impl(T && x)
|
||||
{
|
||||
if constexpr (is_expr<T>::value) {
|
||||
using namespace hana::literals;
|
||||
@@ -224,7 +230,7 @@ namespace boost { namespace yap {
|
||||
|
||||
- Otherwise, \a x is forwarded to the caller. */
|
||||
template<typename T>
|
||||
decltype(auto) value(T && x)
|
||||
constexpr decltype(auto) value(T && x)
|
||||
{
|
||||
return detail::value_impl<false>(static_cast<T &&>(x));
|
||||
}
|
||||
@@ -232,7 +238,7 @@ namespace boost { namespace yap {
|
||||
#ifdef BOOST_NO_CONSTEXPR_IF
|
||||
|
||||
template<typename Expr, typename I>
|
||||
decltype(auto) get(Expr && expr, I const & i);
|
||||
constexpr decltype(auto) get(Expr && expr, I const & i);
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -242,7 +248,7 @@ namespace boost { namespace yap {
|
||||
template<long long I, typename Expr, bool IsLvalueRef>
|
||||
struct get_impl<I, Expr, true, IsLvalueRef>
|
||||
{
|
||||
decltype(auto) operator()(Expr && expr, hana::llong<I> i)
|
||||
constexpr decltype(auto) operator()(Expr && expr, hana::llong<I> i)
|
||||
{
|
||||
return ::boost::yap::get(
|
||||
::boost::yap::deref(static_cast<Expr &&>(expr)), i);
|
||||
@@ -252,7 +258,7 @@ namespace boost { namespace yap {
|
||||
template<long long I, typename Expr>
|
||||
struct get_impl<I, Expr, false, true>
|
||||
{
|
||||
decltype(auto) operator()(Expr && expr, hana::llong<I> i)
|
||||
constexpr decltype(auto) operator()(Expr && expr, hana::llong<I> i)
|
||||
{
|
||||
return expr.elements[i];
|
||||
}
|
||||
@@ -261,7 +267,7 @@ namespace boost { namespace yap {
|
||||
template<long long I, typename Expr>
|
||||
struct get_impl<I, Expr, false, false>
|
||||
{
|
||||
decltype(auto) operator()(Expr && expr, hana::llong<I> i)
|
||||
constexpr decltype(auto) operator()(Expr && expr, hana::llong<I> i)
|
||||
{
|
||||
return std::move(expr.elements[i]);
|
||||
}
|
||||
@@ -277,7 +283,7 @@ namespace boost { namespace yap {
|
||||
\note <code>get()</code> is only valid if \a Expr is an expression.
|
||||
*/
|
||||
template<typename Expr, typename I>
|
||||
decltype(auto) get(Expr && expr, I const & i)
|
||||
constexpr decltype(auto) get(Expr && expr, I const & i)
|
||||
{
|
||||
static_assert(
|
||||
is_expr<Expr>::value, "get() is only defined for expressions.");
|
||||
@@ -317,7 +323,7 @@ namespace boost { namespace yap {
|
||||
|
||||
/** Returns <code>get(expr, boost::hana::llong_c<I>)</code>. */
|
||||
template<long long I, typename Expr>
|
||||
decltype(auto) get_c(Expr && expr)
|
||||
constexpr decltype(auto) get_c(Expr && expr)
|
||||
{
|
||||
return ::boost::yap::get(static_cast<Expr &&>(expr), hana::llong_c<I>);
|
||||
}
|
||||
@@ -330,7 +336,7 @@ namespace boost { namespace yap {
|
||||
operator expression.
|
||||
*/
|
||||
template<typename Expr>
|
||||
decltype(auto) left(Expr && expr)
|
||||
constexpr decltype(auto) left(Expr && expr)
|
||||
{
|
||||
using namespace hana::literals;
|
||||
return ::boost::yap::get(static_cast<Expr &&>(expr), 0_c);
|
||||
@@ -349,7 +355,7 @@ namespace boost { namespace yap {
|
||||
operator expression.
|
||||
*/
|
||||
template<typename Expr>
|
||||
decltype(auto) right(Expr && expr)
|
||||
constexpr decltype(auto) right(Expr && expr)
|
||||
{
|
||||
using namespace hana::literals;
|
||||
return ::boost::yap::get(static_cast<Expr &&>(expr), 1_c);
|
||||
@@ -368,7 +374,7 @@ namespace boost { namespace yap {
|
||||
<code>expr_kind::if_else</code> expression.
|
||||
*/
|
||||
template<typename Expr>
|
||||
decltype(auto) cond(Expr && expr)
|
||||
constexpr decltype(auto) cond(Expr && expr)
|
||||
{
|
||||
using namespace hana::literals;
|
||||
return ::boost::yap::get(static_cast<Expr &&>(expr), 0_c);
|
||||
@@ -386,7 +392,7 @@ namespace boost { namespace yap {
|
||||
<code>expr_kind::if_else</code> expression.
|
||||
*/
|
||||
template<typename Expr>
|
||||
decltype(auto) then(Expr && expr)
|
||||
constexpr decltype(auto) then(Expr && expr)
|
||||
{
|
||||
using namespace hana::literals;
|
||||
return ::boost::yap::get(static_cast<Expr &&>(expr), 1_c);
|
||||
@@ -404,7 +410,7 @@ namespace boost { namespace yap {
|
||||
<code>expr_kind::if_else</code> expression.
|
||||
*/
|
||||
template<typename Expr>
|
||||
decltype(auto) else_(Expr && expr)
|
||||
constexpr decltype(auto) else_(Expr && expr)
|
||||
{
|
||||
using namespace hana::literals;
|
||||
return ::boost::yap::get(static_cast<Expr &&>(expr), 2_c);
|
||||
@@ -422,7 +428,7 @@ namespace boost { namespace yap {
|
||||
<code>expr_kind::call</code> expression.
|
||||
*/
|
||||
template<typename Expr>
|
||||
decltype(auto) callable(Expr && expr)
|
||||
constexpr decltype(auto) callable(Expr && expr)
|
||||
{
|
||||
return ::boost::yap::get(static_cast<Expr &&>(expr), hana::llong_c<0>);
|
||||
constexpr expr_kind kind = detail::remove_cv_ref_t<Expr>::kind;
|
||||
@@ -440,7 +446,7 @@ namespace boost { namespace yap {
|
||||
<code>expr_kind::call</code> expression.
|
||||
*/
|
||||
template<long long I, typename Expr>
|
||||
decltype(auto) argument(Expr && expr, hana::llong<I> i)
|
||||
constexpr decltype(auto) argument(Expr && expr, hana::llong<I> i)
|
||||
{
|
||||
return ::boost::yap::get(
|
||||
static_cast<Expr &&>(expr), hana::llong_c<I + 1>);
|
||||
@@ -473,7 +479,7 @@ namespace boost { namespace yap {
|
||||
template<expr_kind, class> class ExprTemplate,
|
||||
expr_kind Kind,
|
||||
typename... T>
|
||||
auto make_expression(T &&... t)
|
||||
constexpr auto make_expression(T &&... t)
|
||||
{
|
||||
constexpr detail::expr_arity arity = detail::arity_of<Kind>();
|
||||
static_assert(
|
||||
@@ -498,7 +504,7 @@ namespace boost { namespace yap {
|
||||
an expression.
|
||||
*/
|
||||
template<template<expr_kind, class> class ExprTemplate, typename T>
|
||||
auto make_terminal(T && t)
|
||||
constexpr auto make_terminal(T && t)
|
||||
{
|
||||
static_assert(
|
||||
!is_expr<T>::value,
|
||||
@@ -518,13 +524,16 @@ namespace boost { namespace yap {
|
||||
bool IsExpr>
|
||||
struct as_expr_impl
|
||||
{
|
||||
decltype(auto) operator()(T && t) { return static_cast<T &&>(t); }
|
||||
constexpr decltype(auto) operator()(T && t)
|
||||
{
|
||||
return static_cast<T &&>(t);
|
||||
}
|
||||
};
|
||||
|
||||
template<template<expr_kind, class> class ExprTemplate, typename T>
|
||||
struct as_expr_impl<ExprTemplate, T, false>
|
||||
{
|
||||
decltype(auto) operator()(T && t)
|
||||
constexpr decltype(auto) operator()(T && t)
|
||||
{
|
||||
return make_terminal<ExprTemplate>(static_cast<T &&>(t));
|
||||
}
|
||||
@@ -540,7 +549,7 @@ namespace boost { namespace yap {
|
||||
- Otherwise, \a t is wrapped in a terminal expression.
|
||||
*/
|
||||
template<template<expr_kind, class> class ExprTemplate, typename T>
|
||||
decltype(auto) as_expr(T && t)
|
||||
constexpr decltype(auto) as_expr(T && t)
|
||||
{
|
||||
#ifdef BOOST_NO_CONSTEXPR_IF
|
||||
return detail::as_expr_impl<ExprTemplate, T, is_expr<T>::value>{}(
|
||||
@@ -562,7 +571,7 @@ namespace boost { namespace yap {
|
||||
struct expression_function
|
||||
{
|
||||
template<typename... U>
|
||||
decltype(auto) operator()(U &&... u)
|
||||
constexpr decltype(auto) operator()(U &&... u)
|
||||
{
|
||||
return ::boost::yap::evaluate(expr, static_cast<U &&>(u)...);
|
||||
}
|
||||
@@ -590,7 +599,7 @@ namespace boost { namespace yap {
|
||||
Expr is an expression.
|
||||
*/
|
||||
template<typename Expr>
|
||||
auto make_expression_function(Expr && expr)
|
||||
constexpr auto make_expression_function(Expr && expr)
|
||||
{
|
||||
static_assert(
|
||||
is_expr<Expr>::value,
|
||||
@@ -610,7 +619,7 @@ namespace boost { namespace yap {
|
||||
expression with the given values.
|
||||
*/
|
||||
template<typename... T>
|
||||
auto replacements(T &&... t)
|
||||
constexpr auto replacements(T &&... t)
|
||||
{
|
||||
return detail::placeholder_transform_t<T...>(static_cast<T &&>(t)...);
|
||||
}
|
||||
@@ -623,7 +632,7 @@ namespace boost { namespace yap {
|
||||
where <code>max_p</code> is the maximum placeholder index in \a expr.
|
||||
*/
|
||||
template<typename Expr, typename... T>
|
||||
decltype(auto) replace_placeholders(Expr && expr, T &&... t)
|
||||
constexpr decltype(auto) replace_placeholders(Expr && expr, T &&... t)
|
||||
{
|
||||
static_assert(
|
||||
is_expr<Expr>::value,
|
||||
@@ -637,7 +646,7 @@ namespace boost { namespace yap {
|
||||
given values.
|
||||
*/
|
||||
template<typename... T>
|
||||
inline auto evaluation(T &&... t)
|
||||
constexpr auto evaluation(T &&... t)
|
||||
{
|
||||
return detail::evaluation_transform_t<T...>(static_cast<T &&>(t)...);
|
||||
}
|
||||
@@ -649,7 +658,7 @@ namespace boost { namespace yap {
|
||||
expression.
|
||||
*/
|
||||
template<typename Expr, typename... T>
|
||||
decltype(auto) evaluate(Expr && expr, T &&... t)
|
||||
constexpr decltype(auto) evaluate(Expr && expr, T &&... t)
|
||||
{
|
||||
static_assert(
|
||||
is_expr<Expr>::value,
|
||||
@@ -712,7 +721,7 @@ namespace boost { namespace yap {
|
||||
combination of these.
|
||||
*/
|
||||
template<typename Expr, typename Transform, typename... Transforms>
|
||||
decltype(auto) transform_strict(
|
||||
constexpr decltype(auto) transform_strict(
|
||||
Expr && expr, Transform && transform, Transforms &&... transforms)
|
||||
{
|
||||
static_assert(
|
||||
|
||||
Reference in New Issue
Block a user