30 changes: 15 additions & 15 deletions include/boost/hana/detail/variadic/foldl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename ...Xs, typename F, typename S>
constexpr decltype(auto) foldl_impl(F&& f, S&& s, ...) {
return foldl1(
detail::std::forward<F>(f),
detail::std::forward<S>(s),
static_cast<F&&>(f),
static_cast<S&&>(s),
type<Xs>...
);
}

template <typename ...Xs, typename F, typename S>
constexpr decltype(auto) foldl_impl(F&& f, S, Type*) {
return foldl1_t<typename S::type, Xs...>(
detail::std::forward<F>(f)
static_cast<F&&>(f)
);
}

template <typename ...Xs, typename F, typename S>
constexpr decltype(auto) foldl_t(F&& f, S&& s) {
return foldl_impl<Xs...>(
detail::std::forward<F>(f),
detail::std::forward<S>(s),
static_cast<F&&>(f),
static_cast<S&&>(s),
(datatype_t<S>*)0
);
}
Expand All @@ -48,9 +48,9 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename F, typename S, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, S&& s, Xs&& ...xs) const {
return foldl1(
detail::std::forward<F>(f),
detail::std::forward<S>(s),
detail::std::forward<Xs>(xs)...
static_cast<F&&>(f),
static_cast<S&&>(s),
static_cast<Xs&&>(xs)...
);
}
};
Expand All @@ -69,21 +69,21 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename X>
constexpr decltype(auto) operator+(X&& x) const& {
return detail::create<variadic::accumulator>{}(
f, f(state, detail::std::forward<X>(x))
f, f(state, static_cast<X&&>(x))
);
}

template <typename X>
constexpr decltype(auto) operator+(X&& x) & {
return detail::create<variadic::accumulator>{}(
f, f(state, detail::std::forward<X>(x))
f, f(state, static_cast<X&&>(x))
);
}

template <typename X>
constexpr decltype(auto) operator+(X&& x) && {
decltype(auto) result = f(detail::std::move(state),
detail::std::forward<X>(x));
static_cast<X&&>(x));
return detail::create<variadic::accumulator>{}(
detail::std::move(f),
detail::std::forward<decltype(result)>(result)
Expand All @@ -98,16 +98,16 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
struct _foldl {
template <typename ...Xs>
static constexpr decltype(auto) helper(Xs&& ...xs)
{ return (... + detail::std::forward<Xs>(xs)); }
{ return (... + static_cast<Xs&&>(xs)); }

template <typename F, typename State, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, State&& state, Xs&& ...xs) const {
return helper(
detail::create<accumulator>{}(
detail::std::forward<F>(f),
detail::std::forward<State>(state)
static_cast<F&&>(f),
static_cast<State&&>(state)
),
detail::std::forward<Xs>(xs)...
static_cast<Xs&&>(xs)...
).get();
}
};
Expand Down
32 changes: 16 additions & 16 deletions include/boost/hana/detail/variadic/foldl1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename F, typename X1>
static constexpr decltype(auto) apply(F&&, X1&& x1) {
// id handles rvalue-ness properly
return id(detail::std::forward<X1>(x1));
return id(static_cast<X1&&>(x1));
}
};

Expand All @@ -39,9 +39,9 @@ namespace boost { namespace hana { namespace detail { namespace variadic {

template <typename F, typename X1, typename X2>
static constexpr decltype(auto) apply(F&& f, X1&& x1, X2&& x2) {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2)
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2)
);
}
};
Expand All @@ -55,10 +55,10 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
static constexpr decltype(auto) apply(F&& f, X1&& x1, X2&& x2, X3&& x3) {
return f(
f(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2)
static_cast<X1&&>(x1),
static_cast<X2&&>(x2)
),
detail::std::forward<X3>(x3)
static_cast<X3&&>(x3)
);
}
};
Expand All @@ -81,22 +81,22 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
f(
f(
f(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2)
static_cast<X1&&>(x1),
static_cast<X2&&>(x2)
),
detail::std::forward<X3>(x3)
static_cast<X3&&>(x3)
),
detail::std::forward<X4>(x4)
static_cast<X4&&>(x4)
),
detail::std::forward<Xs>(xs)...
static_cast<Xs&&>(xs)...
);
}
};

template <typename ...Xs, typename F>
constexpr decltype(auto) foldl1_helper(F&& f, ...) {
return foldl1_impl<foldl1_next(sizeof...(Xs))>::apply(
detail::std::forward<F>(f), type<Xs>...
static_cast<F&&>(f), type<Xs>...
);
}

Expand All @@ -111,16 +111,16 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename ...Xs, typename F>
constexpr decltype(auto) foldl1_t(F&& f) {
return foldl1_helper<Xs...>(
detail::std::forward<F>(f), (datatype_t<F>*)nullptr
static_cast<F&&>(f), (datatype_t<F>*)nullptr
);
}

struct _foldl1 {
template <typename F, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, Xs&& ...xs) const {
return foldl1_impl<foldl1_next(sizeof...(Xs))>::apply(
detail::std::forward<F>(f),
detail::std::forward<Xs>(xs)...
static_cast<F&&>(f),
static_cast<Xs&&>(xs)...
);
}
};
Expand Down
16 changes: 8 additions & 8 deletions include/boost/hana/detail/variadic/foldr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename ...Xs, typename F, typename S>
constexpr decltype(auto) foldr_impl(F&& f, S&& s, ...) {
return foldr1(
detail::std::forward<F>(f),
static_cast<F&&>(f),
type<Xs>...,
detail::std::forward<S>(s)
static_cast<S&&>(s)
);
}

template <typename ...Xs, typename F, typename S>
constexpr decltype(auto) foldr_impl(F&& f, S, Type*) {
return foldr1_t<Xs..., typename S::type>(
detail::std::forward<F>(f)
static_cast<F&&>(f)
);
}

template <typename ...Xs, typename F, typename S>
constexpr decltype(auto) foldr_t(F&& f, S&& s) {
return foldr_impl<Xs...>(
detail::std::forward<F>(f),
detail::std::forward<S>(s),
static_cast<F&&>(f),
static_cast<S&&>(s),
(datatype_t<S>*)nullptr
);
}
Expand All @@ -47,9 +47,9 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename F, typename S, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, S&& s, Xs&& ...xs) const {
return foldr1(
detail::std::forward<F>(f),
detail::std::forward<Xs>(xs)...,
detail::std::forward<S>(s)
static_cast<F&&>(f),
static_cast<Xs&&>(xs)...,
static_cast<S&&>(s)
);
}
};
Expand Down
30 changes: 15 additions & 15 deletions include/boost/hana/detail/variadic/foldr1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename F, typename X1>
static constexpr decltype(auto) apply(F&&, X1&& x1) {
// id handles rvalue-ness properly
return id(detail::std::forward<X1>(x1));
return id(static_cast<X1&&>(x1));
}
};

Expand All @@ -38,9 +38,9 @@ namespace boost { namespace hana { namespace detail { namespace variadic {

template <typename F, typename X1, typename X2>
static constexpr decltype(auto) apply(F&& f, X1&& x1, X2&& x2) {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2)
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2)
);
}
};
Expand All @@ -53,10 +53,10 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename F, typename X1, typename X2, typename X3>
static constexpr decltype(auto) apply(F&& f, X1&& x1, X2&& x2, X3&& x3) {
return f(
detail::std::forward<X1>(x1),
static_cast<X1&&>(x1),
f(
detail::std::forward<X2>(x2),
detail::std::forward<X3>(x3)
static_cast<X2&&>(x2),
static_cast<X3&&>(x3)
)
);
}
Expand All @@ -78,14 +78,14 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename F, typename X1, typename X2, typename X3, typename ...Xs>
static constexpr decltype(auto) apply(F&& f, X1&& x1, X2&& x2, X3&& x3, Xs&& ...xs) {
return f(
detail::std::forward<X1>(x1),
static_cast<X1&&>(x1),
f(
detail::std::forward<X2>(x2),
static_cast<X2&&>(x2),
f(
detail::std::forward<X3>(x3),
static_cast<X3&&>(x3),
foldr1_impl<foldr1_next(sizeof...(Xs))>::apply(
f,
detail::std::forward<Xs>(xs)...
static_cast<Xs&&>(xs)...
)
)
)
Expand All @@ -96,7 +96,7 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename ...Xs, typename F>
constexpr decltype(auto) foldr1_helper(F&& f, ...) {
return foldr1_impl<foldr1_next(sizeof...(Xs))>::apply(
detail::std::forward<F>(f), type<Xs>...
static_cast<F&&>(f), type<Xs>...
);
}

Expand All @@ -111,16 +111,16 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename ...Xs, typename F>
constexpr decltype(auto) foldr1_t(F&& f) {
return foldr1_helper<Xs...>(
detail::std::forward<F>(f), (datatype_t<F>*)nullptr
static_cast<F&&>(f), (datatype_t<F>*)nullptr
);
}

struct _foldr1 {
template <typename F, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, Xs&& ...xs) const {
return foldr1_impl<foldr1_next(sizeof...(Xs))>::apply(
detail::std::forward<F>(f),
detail::std::forward<Xs>(xs)...
static_cast<F&&>(f),
static_cast<Xs&&>(xs)...
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/boost/hana/detail/variadic/for_each.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
constexpr void operator()(F&& f, Xs&& ...xs) const {
using swallow = int[];
(void)swallow{1,
(f(detail::std::forward<Xs>(xs)), void(), 1)...
(f(static_cast<Xs&&>(xs)), void(), 1)...
};
}
};
Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/detail/variadic/reverse_apply/flat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
constexpr decltype(auto)
reverse_apply_flat_helper(detail::std::integer_sequence<int, i...>, F&& f, X&& ...x)
{
return detail::std::forward<F>(f)(
return static_cast<F&&>(f)(
detail::variadic::at<sizeof...(x) - i - 1>(
detail::std::forward<X>(x)...
static_cast<X&&>(x)...
)...
);
}
Expand All @@ -31,8 +31,8 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
constexpr decltype(auto) reverse_apply_flat(F&& f, X&& ...x) {
return reverse_apply_flat_helper(
detail::std::make_integer_sequence<int, sizeof...(x)>{},
detail::std::forward<F>(f),
detail::std::forward<X>(x)...
static_cast<F&&>(f),
static_cast<X&&>(x)...
);
}
}}}} // end namespace boost::hana::detail::variadic
Expand Down
58 changes: 29 additions & 29 deletions include/boost/hana/detail/variadic/reverse_apply/unrolled.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,65 +18,65 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
struct _reverse_apply_unrolled {
template <typename F>
constexpr decltype(auto) operator()(F&& f) const {
return detail::std::forward<F>(f)();
return static_cast<F&&>(f)();
}

template <typename F, typename X1>
constexpr decltype(auto) operator()(F&& f, X1&& x1) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1)
return static_cast<F&&>(f)(
static_cast<X1&&>(x1)
);
}

template <typename F, typename X1, typename X2>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2) const {
return detail::std::forward<F>(f)(
detail::std::forward<X2>(x2),
detail::std::forward<X1>(x1)
return static_cast<F&&>(f)(
static_cast<X2&&>(x2),
static_cast<X1&&>(x1)
);
}

template <typename F, typename X1, typename X2, typename X3>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3) const {
return detail::std::forward<F>(f)(
detail::std::forward<X3>(x3),
detail::std::forward<X2>(x2),
detail::std::forward<X1>(x1)
return static_cast<F&&>(f)(
static_cast<X3&&>(x3),
static_cast<X2&&>(x2),
static_cast<X1&&>(x1)
);
}

template <typename F, typename X1, typename X2, typename X3, typename X4>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4) const {
return detail::std::forward<F>(f)(
detail::std::forward<X4>(x4),
detail::std::forward<X3>(x3),
detail::std::forward<X2>(x2),
detail::std::forward<X1>(x1)
return static_cast<F&&>(f)(
static_cast<X4&&>(x4),
static_cast<X3&&>(x3),
static_cast<X2&&>(x2),
static_cast<X1&&>(x1)
);
}

template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5) const {
return detail::std::forward<F>(f)(
detail::std::forward<X5>(x5),
detail::std::forward<X4>(x4),
detail::std::forward<X3>(x3),
detail::std::forward<X2>(x2),
detail::std::forward<X1>(x1)
return static_cast<F&&>(f)(
static_cast<X5&&>(x5),
static_cast<X4&&>(x4),
static_cast<X3&&>(x3),
static_cast<X2&&>(x2),
static_cast<X1&&>(x1)
);
}

template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5, typename X6, typename ...Xn>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5, X6&& x6, Xn&& ...xn) const {
return (*this)(detail::reverse_partial(
detail::std::forward<F>(f)
, detail::std::forward<X6>(x6)
, detail::std::forward<X5>(x5)
, detail::std::forward<X4>(x4)
, detail::std::forward<X3>(x3)
, detail::std::forward<X2>(x2)
, detail::std::forward<X1>(x1)
), detail::std::forward<Xn>(xn)...);
static_cast<F&&>(f)
, static_cast<X6&&>(x6)
, static_cast<X5&&>(x5)
, static_cast<X4&&>(x4)
, static_cast<X3&&>(x3)
, static_cast<X2&&>(x2)
, static_cast<X1&&>(x1)
), static_cast<Xn&&>(xn)...);
}
};

Expand Down
108 changes: 54 additions & 54 deletions include/boost/hana/detail/variadic/split_at.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5, typename X6, typename X7, typename X8, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5, X6&& x6, X7&& x7, X8&& x8, Xs&& ...xs) const {
return _split_at<n - 8>{}(
hana::partial(detail::std::forward<F>(f),
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2),
detail::std::forward<X3>(x3),
detail::std::forward<X4>(x4),
detail::std::forward<X5>(x5),
detail::std::forward<X6>(x6),
detail::std::forward<X7>(x7),
detail::std::forward<X8>(x8)
hana::partial(static_cast<F&&>(f),
static_cast<X1&&>(x1),
static_cast<X2&&>(x2),
static_cast<X3&&>(x3),
static_cast<X4&&>(x4),
static_cast<X5&&>(x5),
static_cast<X6&&>(x6),
static_cast<X7&&>(x7),
static_cast<X8&&>(x8)
),
detail::std::forward<Xs>(xs)...
static_cast<Xs&&>(xs)...
);
}
};
Expand All @@ -41,106 +41,106 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
struct _split_at<0> {
template <typename F, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, Xs&& ...xs) const {
return detail::std::forward<F>(f)()(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)()(static_cast<Xs&&>(xs)...);
}
};

template <>
struct _split_at<1> {
template <typename F, typename X1, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, Xs&& ...xs) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1)
)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(
static_cast<X1&&>(x1)
)(static_cast<Xs&&>(xs)...);
}
};

template <>
struct _split_at<2> {
template <typename F, typename X1, typename X2, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, Xs&& ...xs) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2)
)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2)
)(static_cast<Xs&&>(xs)...);
}
};

template <>
struct _split_at<3> {
template <typename F, typename X1, typename X2, typename X3, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, Xs&& ...xs) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2),
detail::std::forward<X3>(x3)
)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2),
static_cast<X3&&>(x3)
)(static_cast<Xs&&>(xs)...);
}
};

template <>
struct _split_at<4> {
template <typename F, typename X1, typename X2, typename X3, typename X4, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, Xs&& ...xs) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2),
detail::std::forward<X3>(x3),
detail::std::forward<X4>(x4)
)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2),
static_cast<X3&&>(x3),
static_cast<X4&&>(x4)
)(static_cast<Xs&&>(xs)...);
}
};

template <>
struct _split_at<5> {
template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5, Xs&& ...xs) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2),
detail::std::forward<X3>(x3),
detail::std::forward<X4>(x4),
detail::std::forward<X5>(x5)
)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2),
static_cast<X3&&>(x3),
static_cast<X4&&>(x4),
static_cast<X5&&>(x5)
)(static_cast<Xs&&>(xs)...);
}
};

template <>
struct _split_at<6> {
template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5, typename X6, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5, X6&& x6, Xs&& ...xs) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2),
detail::std::forward<X3>(x3),
detail::std::forward<X4>(x4),
detail::std::forward<X5>(x5),
detail::std::forward<X6>(x6)
)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2),
static_cast<X3&&>(x3),
static_cast<X4&&>(x4),
static_cast<X5&&>(x5),
static_cast<X6&&>(x6)
)(static_cast<Xs&&>(xs)...);
}
};

template <>
struct _split_at<7> {
template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5, typename X6, typename X7, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5, X6&& x6, X7&& x7, Xs&& ...xs) const {
return detail::std::forward<F>(f)(
detail::std::forward<X1>(x1),
detail::std::forward<X2>(x2),
detail::std::forward<X3>(x3),
detail::std::forward<X4>(x4),
detail::std::forward<X5>(x5),
detail::std::forward<X6>(x6),
detail::std::forward<X7>(x7)
)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(
static_cast<X1&&>(x1),
static_cast<X2&&>(x2),
static_cast<X3&&>(x3),
static_cast<X4&&>(x4),
static_cast<X5&&>(x5),
static_cast<X6&&>(x6),
static_cast<X7&&>(x7)
)(static_cast<Xs&&>(xs)...);
}
};

template <detail::std::size_t n>
struct _make_split_at {
template <typename ...Xs>
constexpr decltype(auto) operator()(Xs&& ...xs) const {
return detail::reverse_partial(_split_at<n>{}, detail::std::forward<Xs>(xs)...);
return detail::reverse_partial(_split_at<n>{}, static_cast<Xs&&>(xs)...);
}
};

Expand Down
6 changes: 3 additions & 3 deletions include/boost/hana/detail/variadic/take.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
struct _take_impl2 {
template <typename F, typename ...Xs>
constexpr decltype(auto) operator()(F&& f, Xs&& ...xs) const {
return detail::std::forward<F>(f)(detail::std::forward<Xs>(xs)...);
return static_cast<F&&>(f)(static_cast<Xs&&>(xs)...);
}
};

Expand All @@ -30,7 +30,7 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
constexpr auto operator()(Xs&& ...xs) const {
return hana::always(
detail::reverse_partial(_take_impl2{},
detail::std::forward<Xs>(xs)...)
static_cast<Xs&&>(xs)...)
);
};
};
Expand All @@ -39,7 +39,7 @@ namespace boost { namespace hana { namespace detail { namespace variadic {
struct _take {
template <typename ...Xs>
constexpr decltype(auto) operator()(Xs&& ...xs) const {
return split_at<n>(detail::std::forward<Xs>(xs)...)(_take_impl1{});
return split_at<n>(static_cast<Xs&&>(xs)...)(_take_impl1{});
}
};

Expand Down
46 changes: 23 additions & 23 deletions include/boost/hana/either.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ namespace boost { namespace hana {
_left(_left&) = default;
template <typename Y, typename = decltype(X(detail::std::declval<Y>()))>
constexpr _left(Y&& y)
: value(detail::std::forward<Y>(y))
: value(static_cast<Y&&>(y))
{ }

template <typename F, typename G>
constexpr decltype(auto) go(F&& f, G const&) const&
{ return detail::std::forward<F>(f)(value); }
{ return static_cast<F&&>(f)(value); }

template <typename F, typename G>
constexpr decltype(auto) go(F f, G const&) &
{ return detail::std::forward<F>(f)(value); }
{ return static_cast<F&&>(f)(value); }

template <typename F, typename G>
constexpr decltype(auto) go(F&& f, G const&) &&
{ return detail::std::forward<F>(f)(detail::std::move(value)); }
{ return static_cast<F&&>(f)(detail::std::move(value)); }
};

//! @cond
template <typename T>
constexpr auto _make_left::operator()(T&& t) const {
return _left<typename detail::std::decay<T>::type>{
detail::std::forward<T>(t)
static_cast<T&&>(t)
};
}
//! @endcond
Expand All @@ -85,27 +85,27 @@ namespace boost { namespace hana {
_right(_right&) = default;
template <typename Y, typename = decltype(X(detail::std::declval<Y>()))>
constexpr _right(Y&& y)
: value(detail::std::forward<Y>(y))
: value(static_cast<Y&&>(y))
{ }

template <typename F, typename G>
constexpr decltype(auto) go(F const&, G&& g) const&
{ return detail::std::forward<G>(g)(value); }
{ return static_cast<G&&>(g)(value); }

template <typename F, typename G>
constexpr decltype(auto) go(F const&, G&& g) &
{ return detail::std::forward<G>(g)(value); }
{ return static_cast<G&&>(g)(value); }

template <typename F, typename G>
constexpr decltype(auto) go(F const&, G&& g) &&
{ return detail::std::forward<G>(g)(detail::std::move(value)); }
{ return static_cast<G&&>(g)(detail::std::move(value)); }
};

//! @cond
template <typename T>
constexpr auto _make_right::operator()(T&& t) const {
return _right<typename detail::std::decay<T>::type>{
detail::std::forward<T>(t)
static_cast<T&&>(t)
};
}
//! @endcond
Expand Down Expand Up @@ -158,8 +158,8 @@ namespace boost { namespace hana {
template <typename E, typename F>
static constexpr decltype(auto) apply(E&& e, F&& f) {
return hana::either(left,
hana::compose(right, detail::std::forward<F>(f)),
detail::std::forward<E>(e)
hana::compose(right, static_cast<F&&>(f)),
static_cast<E&&>(e)
);
}
};
Expand All @@ -171,16 +171,16 @@ namespace boost { namespace hana {
struct lift_impl<Either> {
template <typename X>
static constexpr decltype(auto) apply(X&& x)
{ return hana::right(detail::std::forward<X>(x)); }
{ return hana::right(static_cast<X&&>(x)); }
};

template <>
struct ap_impl<Either> {
template <typename E, typename X>
static constexpr decltype(auto) apply(E&& e, X&& x) {
return hana::either(left,
hana::partial(transform, detail::std::forward<X>(x)),
detail::std::forward<E>(e)
hana::partial(transform, static_cast<X&&>(x)),
static_cast<E&&>(e)
);
}
};
Expand All @@ -192,7 +192,7 @@ namespace boost { namespace hana {
struct flatten_impl<Either> {
template <typename E>
static constexpr decltype(auto) apply(E&& e)
{ return hana::either(left, id, detail::std::forward<E>(e)); }
{ return hana::either(left, id, static_cast<E&&>(e)); }
};

//////////////////////////////////////////////////////////////////////////
Expand All @@ -202,20 +202,20 @@ namespace boost { namespace hana {
struct unpack_impl<Either> {
template <typename T, typename F>
static constexpr decltype(auto) apply(_left<T> const&, F&& f)
{ return detail::std::forward<F>(f)(); }
{ return static_cast<F&&>(f)(); }


template <typename T, typename F>
static constexpr decltype(auto) apply(_right<T> const& x, F&& f)
{ return detail::std::forward<F>(f)(x.value); }
{ return static_cast<F&&>(f)(x.value); }

template <typename T, typename F>
static constexpr decltype(auto) apply(_right<T>& x, F&& f)
{ return detail::std::forward<F>(f)(x.value); }
{ return static_cast<F&&>(f)(x.value); }

template <typename T, typename F>
static constexpr decltype(auto) apply(_right<T>&& x, F&& f)
{ return detail::std::forward<F>(f)(detail::std::move(x.value)); }
{ return static_cast<F&&>(f)(detail::std::move(x.value)); }
};

//////////////////////////////////////////////////////////////////////////
Expand All @@ -235,15 +235,15 @@ namespace boost { namespace hana {

template <typename A, typename T, typename F>
static constexpr decltype(auto) apply(_right<T> const& e, F&& f) {
return hana::transform(detail::std::forward<F>(f)(e.value), right);
return hana::transform(static_cast<F&&>(f)(e.value), right);
}
template <typename A, typename T, typename F>
static constexpr decltype(auto) apply(_right<T>& e, F&& f) {
return hana::transform(detail::std::forward<F>(f)(e.value), right);
return hana::transform(static_cast<F&&>(f)(e.value), right);
}
template <typename A, typename T, typename F>
static constexpr decltype(auto) apply(_right<T>&& e, F&& f) {
return hana::transform(detail::std::forward<F>(f)(
return hana::transform(static_cast<F&&>(f)(
detail::std::move(e.value)), right);
}
};
Expand Down
10 changes: 5 additions & 5 deletions include/boost/hana/ext/boost/fusion/deque.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace boost { namespace hana {
template <typename Xs>
static constexpr decltype(auto) apply(Xs&& xs) {
return ::boost::fusion::as_deque(
::boost::fusion::pop_front(detail::std::forward<Xs>(xs)));
::boost::fusion::pop_front(static_cast<Xs&&>(xs)));
}
};

Expand All @@ -78,8 +78,8 @@ namespace boost { namespace hana {
static constexpr decltype(auto) apply(X&& x, Xs&& xs) {
return ::boost::fusion::as_deque(
::boost::fusion::push_front(
detail::std::forward<Xs>(xs),
detail::std::forward<X>(x)));
static_cast<Xs&&>(xs),
static_cast<X&&>(x)));
}
};

Expand All @@ -89,8 +89,8 @@ namespace boost { namespace hana {
static constexpr decltype(auto) apply(Xs&& xs, Ys&& ys) {
return ::boost::fusion::as_deque(
::boost::fusion::join(
detail::std::forward<Xs>(xs),
detail::std::forward<Ys>(ys)));
static_cast<Xs&&>(xs),
static_cast<Ys&&>(ys)));
}
};

Expand Down
10 changes: 5 additions & 5 deletions include/boost/hana/ext/boost/fusion/list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace boost { namespace hana {
template <typename Xs>
static constexpr decltype(auto) apply(Xs&& xs) {
return ::boost::fusion::as_list(
::boost::fusion::pop_front(detail::std::forward<Xs>(xs)));
::boost::fusion::pop_front(static_cast<Xs&&>(xs)));
}
};

Expand All @@ -78,8 +78,8 @@ namespace boost { namespace hana {
static constexpr decltype(auto) apply(X&& x, Xs&& xs) {
return ::boost::fusion::as_list(
::boost::fusion::push_front(
detail::std::forward<Xs>(xs),
detail::std::forward<X>(x)));
static_cast<Xs&&>(xs),
static_cast<X&&>(x)));
}
};

Expand All @@ -89,8 +89,8 @@ namespace boost { namespace hana {
static constexpr decltype(auto) apply(Xs&& xs, Ys&& ys) {
return ::boost::fusion::as_list(
::boost::fusion::join(
detail::std::forward<Xs>(xs),
detail::std::forward<Ys>(ys)));
static_cast<Xs&&>(xs),
static_cast<Ys&&>(ys)));
}
};

Expand Down
10 changes: 5 additions & 5 deletions include/boost/hana/ext/boost/fusion/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace boost { namespace hana {
template <typename Xs>
static constexpr decltype(auto) apply(Xs&& xs) {
return ::boost::fusion::as_vector(
::boost::fusion::pop_front(detail::std::forward<Xs>(xs)));
::boost::fusion::pop_front(static_cast<Xs&&>(xs)));
}
};

Expand All @@ -72,8 +72,8 @@ namespace boost { namespace hana {
static constexpr decltype(auto) apply(X&& x, Xs&& xs) {
return ::boost::fusion::as_vector(
::boost::fusion::push_front(
detail::std::forward<Xs>(xs),
detail::std::forward<X>(x)));
static_cast<Xs&&>(xs),
static_cast<X&&>(x)));
}
};

Expand All @@ -83,8 +83,8 @@ namespace boost { namespace hana {
static constexpr decltype(auto) apply(Xs&& xs, Ys&& ys) {
return ::boost::fusion::as_vector(
::boost::fusion::join(
detail::std::forward<Xs>(xs),
detail::std::forward<Ys>(ys)));
static_cast<Xs&&>(xs),
static_cast<Ys&&>(ys)));
}
};

Expand Down
4 changes: 2 additions & 2 deletions include/boost/hana/ext/std/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace boost { namespace hana {
template <typename T, std::size_t N, typename Xs, std::size_t ...index>
static constexpr auto tail_helper(Xs&& xs, detail::std::index_sequence<index...>) {
return ::std::array<T, N - 1>{{
detail::std::forward<Xs>(xs)[index + 1]...
static_cast<Xs&&>(xs)[index + 1]...
}};
}

Expand All @@ -116,7 +116,7 @@ namespace boost { namespace hana {
constexpr auto N = ::std::tuple_size<RawArray>::value;
using T = typename RawArray::value_type;
return tail_helper<T, N>(
detail::std::forward<Xs>(xs),
static_cast<Xs&&>(xs),
detail::std::make_index_sequence<N - 1>{}
);
}
Expand Down
2 changes: 1 addition & 1 deletion include/boost/hana/ext/std/integer_sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace boost { namespace hana {
template <typename T, T ...v, typename F>
static constexpr decltype(auto)
apply(::std::integer_sequence<T, v...>, F&& f) {
return detail::std::forward<F>(f)(
return static_cast<F&&>(f)(
std::integral_constant<T, v>{}...
);
}
Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/ext/std/pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ namespace boost { namespace hana {
struct make_impl<ext::std::Pair> {
template <typename X, typename Y>
static constexpr decltype(auto) apply(X&& x, Y&& y) {
return ::std::make_pair(detail::std::forward<X>(x),
detail::std::forward<Y>(y));
return ::std::make_pair(static_cast<X&&>(x),
static_cast<Y&&>(y));
}
};

template <>
struct first_impl<ext::std::Pair> {
template <typename P>
static constexpr decltype(auto) apply(P&& p)
{ return detail::std::forward<P>(p).first; }
{ return static_cast<P&&>(p).first; }
};

template <>
struct second_impl<ext::std::Pair> {
template <typename P>
static constexpr decltype(auto) apply(P&& p)
{ return detail::std::forward<P>(p).second; }
{ return static_cast<P&&>(p).second; }
};
}} // end namespace boost::hana

Expand Down
24 changes: 12 additions & 12 deletions include/boost/hana/ext/std/tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace boost { namespace hana {
struct make_impl<ext::std::Tuple> {
template <typename ...Xs>
static constexpr decltype(auto) apply(Xs&& ...xs) {
return ::std::make_tuple(detail::std::forward<Xs>(xs)...);
return ::std::make_tuple(static_cast<Xs&&>(xs)...);
}
};

Expand All @@ -63,7 +63,7 @@ namespace boost { namespace hana {
static constexpr decltype(auto)
transform_helper(Xs&& xs, F&& f, detail::std::index_sequence<index...>) {
return ::std::make_tuple(
f(::std::get<index>(detail::std::forward<Xs>(xs)))...
f(::std::get<index>(static_cast<Xs&&>(xs)))...
);
}

Expand All @@ -72,8 +72,8 @@ namespace boost { namespace hana {
using Raw = typename detail::std::remove_reference<Xs>::type;
constexpr auto N = ::std::tuple_size<Raw>::value;
return transform_helper(
detail::std::forward<Xs>(xs),
detail::std::forward<F>(f),
static_cast<Xs&&>(xs),
static_cast<F&&>(f),
detail::std::make_index_sequence<N>{}
);
}
Expand All @@ -87,7 +87,7 @@ namespace boost { namespace hana {
template <typename X>
static constexpr auto apply(X&& x) {
return ::std::tuple<typename detail::std::decay<X>::type>{
detail::std::forward<X>(x)};
static_cast<X&&>(x)};
}
};

Expand All @@ -101,7 +101,7 @@ namespace boost { namespace hana {
flatten_helper(Xs&& xs, detail::std::index_sequence<i...>) {
return ::std::tuple_cat(::std::get<i>(
#ifndef BOOST_HANA_CONFIG_LIBCPP_HAS_BUG_22806
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
#else
xs
#endif
Expand All @@ -125,8 +125,8 @@ namespace boost { namespace hana {
template <typename Xs, typename Ys>
static constexpr decltype(auto) apply(Xs&& xs, Ys&& ys) {
#ifndef BOOST_HANA_CONFIG_LIBCPP_HAS_BUG_22806
return ::std::tuple_cat(detail::std::forward<Xs>(xs),
detail::std::forward<Ys>(ys));
return ::std::tuple_cat(static_cast<Xs&&>(xs),
static_cast<Ys&&>(ys));
#else
return ::std::tuple_cat(xs, ys);
#endif
Expand All @@ -146,7 +146,7 @@ namespace boost { namespace hana {
struct head_impl<ext::std::Tuple> {
template <typename Xs>
static constexpr decltype(auto) apply(Xs&& xs) {
return ::std::get<0>(detail::std::forward<Xs>(xs));
return ::std::get<0>(static_cast<Xs&&>(xs));
}
};

Expand All @@ -156,7 +156,7 @@ namespace boost { namespace hana {
static constexpr decltype(auto)
tail_helper(Xs&& xs, detail::std::index_sequence<index...>) {
return ::std::make_tuple(
::std::get<index + 1>(detail::std::forward<Xs>(xs))...
::std::get<index + 1>(static_cast<Xs&&>(xs))...
);
}

Expand All @@ -165,7 +165,7 @@ namespace boost { namespace hana {
using Raw = typename detail::std::remove_reference<Xs>::type;
constexpr auto N = ::std::tuple_size<Raw>::value;
return tail_helper(
detail::std::forward<Xs>(xs),
static_cast<Xs&&>(xs),
detail::std::make_index_sequence<N - 1>{}
);
}
Expand All @@ -183,7 +183,7 @@ namespace boost { namespace hana {
template <typename N, typename Xs>
static constexpr decltype(auto) apply(N const&, Xs&& xs) {
constexpr detail::std::size_t index = hana::value<N>();
return ::std::get<index>(detail::std::forward<Xs>(xs));
return ::std::get<index>(static_cast<Xs&&>(xs));
}
};

Expand Down
146 changes: 73 additions & 73 deletions include/boost/hana/foldable.hpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions include/boost/hana/functional/apply.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace boost { namespace hana {
struct _apply {
template <typename F, typename ...Args>
constexpr decltype(auto) operator()(F&& f, Args&& ...args) const {
return detail::std::forward<F>(f)(
detail::std::forward<Args>(args)...
return static_cast<F&&>(f)(
static_cast<Args&&>(args)...
);
}
};
Expand Down
14 changes: 7 additions & 7 deletions include/boost/hana/functional/arg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,36 @@ namespace boost { namespace hana {
struct _arg<1> {
template <typename X1, typename ...Xn>
constexpr X1 operator()(X1&& x1, Xn&& ...) const
{ return detail::std::forward<X1>(x1); }
{ return static_cast<X1&&>(x1); }
};

template <>
struct _arg<2> {
template <typename X1, typename X2, typename ...Xn>
constexpr X2 operator()(X1&&, X2&& x2, Xn&& ...) const
{ return detail::std::forward<X2>(x2); }
{ return static_cast<X2&&>(x2); }
};

template <>
struct _arg<3> {
template <typename X1, typename X2, typename X3, typename ...Xn>
constexpr X3 operator()(X1&&, X2&&, X3&& x3, Xn&& ...) const
{ return detail::std::forward<X3>(x3); }
{ return static_cast<X3&&>(x3); }
};

template <>
struct _arg<4> {
template <typename X1, typename X2, typename X3, typename X4, typename ...Xn>
constexpr X4 operator()(X1&&, X2&&, X3&&, X4&& x4, Xn&& ...) const
{ return detail::std::forward<X4>(x4); }
{ return static_cast<X4&&>(x4); }
};

template <>
struct _arg<5> {
template <typename X1, typename X2, typename X3, typename X4,
typename X5, typename ...Xn>
constexpr X5 operator()(X1&&, X2&&, X3&&, X4&&, X5&& x5, Xn&& ...) const
{ return detail::std::forward<X5>(x5); }
{ return static_cast<X5&&>(x5); }
};

template <detail::std::size_t n, typename>
Expand All @@ -116,7 +116,7 @@ namespace boost { namespace hana {
// Since compilers will typically try to continue for a bit after
// an error/static assertion, we must avoid sending the compiler
// in a very long computation if n == 0.
return _arg<n == 0 ? 1 : n - 5>{}(detail::std::forward<Xn>(xn)...);
return _arg<n == 0 ? 1 : n - 5>{}(static_cast<Xn&&>(xn)...);
}
};

Expand All @@ -135,7 +135,7 @@ namespace boost { namespace hana {
X11&&, X12&&, X13&&, X14&&, X15&&,
X16&&, X17&&, X18&&, X19&&, X20&&,
X21&&, X22&&, X23&&, X24&&, X25&&, Xn&& ...xn) const
{ return _arg<n - 25>{}(detail::std::forward<Xn>(xn)...); }
{ return _arg<n - 25>{}(static_cast<Xn&&>(xn)...); }
};

template <detail::std::size_t n>
Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/functional/capture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ namespace boost { namespace hana {

template <typename F>
constexpr decltype(auto) operator()(F&& f) const& {
return hana::partial(detail::std::forward<F>(f),
return hana::partial(static_cast<F&&>(f),
static_cast<X const&>(x).get...);
}

template <typename F>
constexpr decltype(auto) operator()(F&& f) & {
return hana::partial(detail::std::forward<F>(f),
return hana::partial(static_cast<F&&>(f),
static_cast<X&>(x).get...);
}

template <typename F>
constexpr decltype(auto) operator()(F&& f) && {
return hana::partial(detail::std::forward<F>(f),
return hana::partial(static_cast<F&&>(f),
static_cast<X&&>(x).get...);
}
};
Expand All @@ -70,7 +70,7 @@ namespace boost { namespace hana {
template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) const {
return detail::create<_capture>{}(
detail::create<detail::closure>{}(detail::std::forward<X>(x)...)
detail::create<detail::closure>{}(static_cast<X&&>(x)...)
);
}
};
Expand Down
18 changes: 9 additions & 9 deletions include/boost/hana/functional/compose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,24 @@ namespace boost { namespace hana {
template <typename X, typename ...Xs>
constexpr decltype(auto) operator()(X&& x, Xs&& ...xs) const& {
return f(
g(detail::std::forward<X>(x)),
detail::std::forward<Xs>(xs)...
g(static_cast<X&&>(x)),
static_cast<Xs&&>(xs)...
);
}

template <typename X, typename ...Xs>
constexpr decltype(auto) operator()(X&& x, Xs&& ...xs) & {
return f(
g(detail::std::forward<X>(x)),
detail::std::forward<Xs>(xs)...
g(static_cast<X&&>(x)),
static_cast<Xs&&>(xs)...
);
}

template <typename X, typename ...Xs>
constexpr decltype(auto) operator()(X&& x, Xs&& ...xs) && {
return detail::std::move(f)(
detail::std::move(g)(detail::std::forward<X>(x)),
detail::std::forward<Xs>(xs)...
detail::std::move(g)(static_cast<X&&>(x)),
static_cast<Xs&&>(xs)...
);
}
};
Expand All @@ -93,9 +93,9 @@ namespace boost { namespace hana {
template <typename F, typename G, typename ...H>
constexpr decltype(auto) operator()(F&& f, G&& g, H&& ...h) const {
return detail::variadic::foldl(detail::create<_compose>{},
detail::std::forward<F>(f),
detail::std::forward<G>(g),
detail::std::forward<H>(h)...
static_cast<F&&>(f),
static_cast<G&&>(g),
static_cast<H&&>(h)...
);
}
};
Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/functional/curry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace boost { namespace hana {
struct _make_curry {
template <typename F>
constexpr _curry<n, typename detail::std::decay<F>::type>
operator()(F&& f) const { return {detail::std::forward<F>(f)}; }
operator()(F&& f) const { return {static_cast<F&&>(f)}; }
};

template <detail::std::size_t n>
Expand All @@ -127,7 +127,7 @@ namespace boost { namespace hana {
static_assert(sizeof...(x) <= n,
"too many arguments provided to boost::hana::curry");
return curry_detail::curry_or_call<n - sizeof...(x)>(
partial(f, detail::std::forward<X>(x)...)
partial(f, static_cast<X&&>(x)...)
);
}

Expand All @@ -136,7 +136,7 @@ namespace boost { namespace hana {
static_assert(sizeof...(x) <= n,
"too many arguments provided to boost::hana::curry");
return curry_detail::curry_or_call<n - sizeof...(x)>(
partial(f, detail::std::forward<X>(x)...)
partial(f, static_cast<X&&>(x)...)
);
}

Expand All @@ -145,7 +145,7 @@ namespace boost { namespace hana {
static_assert(sizeof...(x) <= n,
"too many arguments provided to boost::hana::curry");
return curry_detail::curry_or_call<n - sizeof...(x)>(
partial(detail::std::move(f), detail::std::forward<X>(x)...)
partial(detail::std::move(f), static_cast<X&&>(x)...)
);
}
};
Expand Down
4 changes: 2 additions & 2 deletions include/boost/hana/functional/demux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ namespace boost { namespace hana {
template <typename ...G>
constexpr decltype(auto) operator()(G&& ...g) const& {
return detail::create<_demux>{}(f,
detail::create<detail::closure>{}(detail::std::forward<G>(g)...)
detail::create<detail::closure>{}(static_cast<G&&>(g)...)
);
}

template <typename ...G>
constexpr decltype(auto) operator()(G&& ...g) && {
return detail::create<_demux>{}(detail::std::move(f),
detail::create<detail::closure>{}(detail::std::forward<G>(g)...)
detail::create<detail::closure>{}(static_cast<G&&>(g)...)
);
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/boost/hana/functional/fix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ namespace boost { namespace hana {

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) const&
{ return f(fix(f), detail::std::forward<X>(x)...); }
{ return f(fix(f), static_cast<X&&>(x)...); }

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) &
{ return f(fix(f), detail::std::forward<X>(x)...); }
{ return f(fix(f), static_cast<X&&>(x)...); }

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) &&
{ return detail::std::move(f)(fix(f), detail::std::forward<X>(x)...); }
{ return detail::std::move(f)(fix(f), static_cast<X&&>(x)...); }
};
#endif
}} // end namespace boost::hana
Expand Down
18 changes: 9 additions & 9 deletions include/boost/hana/functional/flip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ namespace boost { namespace hana {
template <typename X, typename Y, typename ...Z>
constexpr decltype(auto) operator()(X&& x, Y&& y, Z&& ...z) const& {
return f(
detail::std::forward<Y>(y),
detail::std::forward<X>(x),
detail::std::forward<Z>(z)...
static_cast<Y&&>(y),
static_cast<X&&>(x),
static_cast<Z&&>(z)...
);
}

template <typename X, typename Y, typename ...Z>
constexpr decltype(auto) operator()(X&& x, Y&& y, Z&& ...z) & {
return f(
detail::std::forward<Y>(y),
detail::std::forward<X>(x),
detail::std::forward<Z>(z)...
static_cast<Y&&>(y),
static_cast<X&&>(x),
static_cast<Z&&>(z)...
);
}

template <typename X, typename Y, typename ...Z>
constexpr decltype(auto) operator()(X&& x, Y&& y, Z&& ...z) && {
return detail::std::move(f)(
detail::std::forward<Y>(y),
detail::std::forward<X>(x),
detail::std::forward<Z>(z)...
static_cast<Y&&>(y),
static_cast<X&&>(x),
static_cast<Z&&>(z)...
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/boost/hana/functional/id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace boost { namespace hana {
struct _id {
template <typename T>
constexpr T operator()(T&& t) const {
return detail::std::forward<T>(t);
return static_cast<T&&>(t);
}
};

Expand Down
18 changes: 9 additions & 9 deletions include/boost/hana/functional/infix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,22 @@ namespace boost { namespace hana {

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) const&
{ return f(detail::std::forward<X>(x)...); }
{ return f(static_cast<X&&>(x)...); }

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) &
{ return f(detail::std::forward<X>(x)...); }
{ return f(static_cast<X&&>(x)...); }

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) &&
{ return detail::std::move(f)(detail::std::forward<X>(x)...); }
{ return detail::std::move(f)(static_cast<X&&>(x)...); }
};

template <bool left, bool right>
struct make_infix {
template <typename F>
constexpr _infix<left, right, typename detail::std::decay<F>::type>
operator()(F&& f) const { return {detail::std::forward<F>(f)}; }
operator()(F&& f) const { return {static_cast<F&&>(f)}; }
};

template <bool left, bool right>
Expand All @@ -129,7 +129,7 @@ namespace boost { namespace hana {
static constexpr decltype(auto) apply(F&& f, Y&& y) {
return make_infix<false, true>{}(
detail::reverse_partial(
detail::std::forward<F>(f), detail::std::forward<Y>(y)
static_cast<F&&>(f), static_cast<Y&&>(y)
)
);
}
Expand All @@ -140,7 +140,7 @@ namespace boost { namespace hana {
struct bind_infix<Infix<true, false>, Object> {
template <typename F, typename Y>
static constexpr decltype(auto) apply(F&& f, Y&& y) {
return detail::std::forward<F>(f)(detail::std::forward<Y>(y));
return static_cast<F&&>(f)(static_cast<Y&&>(y));
}
};

Expand All @@ -150,7 +150,7 @@ namespace boost { namespace hana {
template <typename X, typename F>
static constexpr decltype(auto) apply(X&& x, F&& f) {
return make_infix<true, false>{}(
partial(detail::std::forward<F>(f), detail::std::forward<X>(x))
partial(static_cast<F&&>(f), static_cast<X&&>(x))
);
}
};
Expand All @@ -160,7 +160,7 @@ namespace boost { namespace hana {
struct bind_infix<Object, Infix<false, true>> {
template <typename X, typename F>
static constexpr decltype(auto) apply(X&& x, F&& f) {
return detail::std::forward<F>(f)(detail::std::forward<X>(x));
return static_cast<F&&>(f)(static_cast<X&&>(x));
}
};

Expand All @@ -174,7 +174,7 @@ namespace boost { namespace hana {
return bind_infix<
typename dispatch<strip<X>>::type,
typename dispatch<strip<Y>>::type
>::apply(detail::std::forward<X>(x), detail::std::forward<Y>(y));
>::apply(static_cast<X&&>(x), static_cast<Y&&>(y));
}
} // end namespace infix_detail

Expand Down
26 changes: 13 additions & 13 deletions include/boost/hana/functional/iterate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,46 +82,46 @@ namespace boost { namespace hana {
struct _iterate<0> {
template <typename F, typename X>
constexpr X operator()(F&&, X&& x) const
{ return detail::std::forward<X>(x); }
{ return static_cast<X&&>(x); }
};

template <>
struct _iterate<1> {
template <typename F, typename X>
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return f(detail::std::forward<X>(x));
return f(static_cast<X&&>(x));
}
};

template <>
struct _iterate<2> {
template <typename F, typename X>
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return f(f(detail::std::forward<X>(x)));
return f(f(static_cast<X&&>(x)));
}
};

template <>
struct _iterate<3> {
template <typename F, typename X>
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return f(f(f(detail::std::forward<X>(x))));
return f(f(f(static_cast<X&&>(x))));
}
};

template <>
struct _iterate<4> {
template <typename F, typename X>
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return f(f(f(f(detail::std::forward<X>(x)))));
return f(f(f(f(static_cast<X&&>(x)))));
}
};

template <>
struct _iterate<5> {
template <typename F, typename X>
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return f(f(f(f(f(detail::std::forward<X>(x))))));
return f(f(f(f(f(static_cast<X&&>(x))))));
}
};

Expand All @@ -130,7 +130,7 @@ namespace boost { namespace hana {
template <typename F, typename X>
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return _iterate<n - 6>{}(f,
f(f(f(f(f(f(detail::std::forward<X>(x)))))))
f(f(f(f(f(f(static_cast<X&&>(x)))))))
);
}
};
Expand All @@ -141,7 +141,7 @@ namespace boost { namespace hana {
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return _iterate<n - 12>{}(f,
f(f(f(f(f(f(f(f(f(f(f(f(
detail::std::forward<X>(x)
static_cast<X&&>(x)
))))))))))))
);
}
Expand All @@ -154,7 +154,7 @@ namespace boost { namespace hana {
return _iterate<n - 24>{}(f,
f(f(f(f(f(f(f(f(f(f(f(f(
f(f(f(f(f(f(f(f(f(f(f(f(
detail::std::forward<X>(x)
static_cast<X&&>(x)
))))))))))))
))))))))))))
);
Expand All @@ -170,7 +170,7 @@ namespace boost { namespace hana {
f(f(f(f(f(f(f(f(f(f(f(f(
f(f(f(f(f(f(f(f(f(f(f(f(
f(f(f(f(f(f(f(f(f(f(f(f(
detail::std::forward<X>(x)
static_cast<X&&>(x)
))))))))))))
))))))))))))
))))))))))))
Expand All @@ -183,12 +183,12 @@ namespace boost { namespace hana {
struct _make_iterate {
template <typename F>
constexpr decltype(auto) operator()(F&& f) const
{ return hana::partial(_iterate<n>{}, detail::std::forward<F>(f)); }
{ return hana::partial(_iterate<n>{}, static_cast<F&&>(f)); }

template <typename F, typename X>
constexpr decltype(auto) operator()(F&& f, X&& x) const {
return _iterate<n>{}(detail::std::forward<F>(f),
detail::std::forward<X>(x));
return _iterate<n>{}(static_cast<F&&>(f),
static_cast<X&&>(x));
}
};

Expand Down
10 changes: 5 additions & 5 deletions include/boost/hana/functional/lockstep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ namespace boost { namespace hana {

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) const& {
return f(static_cast<G const&>(g).get(detail::std::forward<X>(x))...);
return f(static_cast<G const&>(g).get(static_cast<X&&>(x))...);
}

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) & {
return f(static_cast<G&>(g).get(detail::std::forward<X>(x))...);
return f(static_cast<G&>(g).get(static_cast<X&&>(x))...);
}

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) && {
return f(static_cast<G&&>(g).get(detail::std::forward<X>(x))...);
return f(static_cast<G&&>(g).get(static_cast<X&&>(x))...);
}
};

Expand All @@ -71,14 +71,14 @@ namespace boost { namespace hana {
template <typename ...G>
constexpr decltype(auto) operator()(G&& ...g) const& {
return detail::create<_lockstep>{}(f,
detail::create<detail::closure>{}(detail::std::forward<G>(g)...)
detail::create<detail::closure>{}(static_cast<G&&>(g)...)
);
}

template <typename ...G>
constexpr decltype(auto) operator()(G&& ...g) && {
return detail::create<_lockstep>{}(detail::std::move(f),
detail::create<detail::closure>{}(detail::std::forward<G>(g)...)
detail::create<detail::closure>{}(static_cast<G&&>(g)...)
);
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/boost/hana/functional/on.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ namespace boost { namespace hana {
F f; G g;
template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) const& {
return f(g(detail::std::forward<X>(x))...);
return f(g(static_cast<X&&>(x))...);
}

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) & {
return f(g(detail::std::forward<X>(x))...);
return f(g(static_cast<X&&>(x))...);
}

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) && {
return detail::std::move(f)(g(detail::std::forward<X>(x))...);
return detail::std::move(f)(g(static_cast<X&&>(x))...);
}
};

Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/functional/overload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace boost { namespace hana {

template <typename F_, typename ...G_>
constexpr explicit _overload(F_&& f, G_&& ...g)
: _overload<F>::type(detail::std::forward<F_>(f))
, _overload<G...>::type(detail::std::forward<G_>(g)...)
: _overload<F>::type(static_cast<F_&&>(f))
, _overload<G...>::type(static_cast<G_&&>(g)...)
{ }
};

Expand All @@ -67,7 +67,7 @@ namespace boost { namespace hana {
{ }

constexpr R operator()(Args ...args) const
{ return fptr_(detail::std::forward<Args>(args)...); }
{ return fptr_(static_cast<Args&&>(args)...); }
};

struct _make_overload {
Expand All @@ -77,7 +77,7 @@ namespace boost { namespace hana {
>::type
>
constexpr Overload operator()(F&& ...f) const {
return Overload(detail::std::forward<F>(f)...);
return Overload(static_cast<F&&>(f)...);
}
};

Expand Down
10 changes: 5 additions & 5 deletions include/boost/hana/functional/partial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ namespace boost { namespace hana {

template <typename ...Y>
constexpr decltype(auto) operator()(Y&& ...y) const& {
return f(static_cast<X const&>(x).get..., detail::std::forward<Y>(y)...);
return f(static_cast<X const&>(x).get..., static_cast<Y&&>(y)...);
}

template <typename ...Y>
constexpr decltype(auto) operator()(Y&& ...y) & {
return f(static_cast<X&>(x).get..., detail::std::forward<Y>(y)...);
return f(static_cast<X&>(x).get..., static_cast<Y&&>(y)...);
}

template <typename ...Y>
constexpr decltype(auto) operator()(Y&& ...y) && {
return detail::std::move(f)(
static_cast<X&&>(x).get..., detail::std::forward<Y>(y)...
static_cast<X&&>(x).get..., static_cast<Y&&>(y)...
);
}
};
Expand All @@ -67,8 +67,8 @@ namespace boost { namespace hana {
template <typename F, typename ...X>
constexpr decltype(auto) operator()(F&& f, X&& ...x) const {
return detail::create<_partial>{}(
detail::std::forward<F>(f),
detail::create<detail::closure>{}(detail::std::forward<X>(x)...)
static_cast<F&&>(f),
detail::create<detail::closure>{}(static_cast<X&&>(x)...)
);
}
};
Expand Down
64 changes: 32 additions & 32 deletions include/boost/hana/functional/placeholder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ namespace boost { namespace hana {

template <typename Xs, typename ...Z>
constexpr auto operator()(Xs&& xs, Z const& ...) const&
-> decltype(detail::std::forward<Xs>(xs)[i])
{ return detail::std::forward<Xs>(xs)[i]; }
-> decltype(static_cast<Xs&&>(xs)[i])
{ return static_cast<Xs&&>(xs)[i]; }

template <typename Xs, typename ...Z>
constexpr auto operator()(Xs&& xs, Z const& ...) &
-> decltype(detail::std::forward<Xs>(xs)[i])
{ return detail::std::forward<Xs>(xs)[i]; }
-> decltype(static_cast<Xs&&>(xs)[i])
{ return static_cast<Xs&&>(xs)[i]; }

template <typename Xs, typename ...Z>
constexpr auto operator()(Xs&& xs, Z const& ...) &&
-> decltype(detail::std::forward<Xs>(xs)[detail::std::declval<I>()])
{ return detail::std::forward<Xs>(xs)[detail::std::move(i)]; }
-> decltype(static_cast<Xs&&>(xs)[detail::std::declval<I>()])
{ return static_cast<Xs&&>(xs)[detail::std::move(i)]; }
};

template <typename X>
Expand All @@ -97,36 +97,36 @@ namespace boost { namespace hana {

template <typename F, typename ...Z>
constexpr auto operator()(F&& f, Z const& ...) const&
-> decltype(detail::std::forward<F>(f)(static_cast<X const&>(
-> decltype(static_cast<F&&>(f)(static_cast<X const&>(
detail::std::declval<detail::closure_impl<X...>>()
).get...))
{ return detail::std::forward<F>(f)(static_cast<X const&>(x).get...); }
{ return static_cast<F&&>(f)(static_cast<X const&>(x).get...); }

template <typename F, typename ...Z>
constexpr auto operator()(F&& f, Z const& ...) &
-> decltype(detail::std::forward<F>(f)(static_cast<X&>(
-> decltype(static_cast<F&&>(f)(static_cast<X&>(
detail::std::declval<detail::closure_impl<X...>&>()
).get...))
{ return detail::std::forward<F>(f)(static_cast<X&>(x).get...); }
{ return static_cast<F&&>(f)(static_cast<X&>(x).get...); }

template <typename F, typename ...Z>
constexpr auto operator()(F&& f, Z const& ...) &&
-> decltype(detail::std::forward<F>(f)(static_cast<X&&>(
-> decltype(static_cast<F&&>(f)(static_cast<X&&>(
detail::std::declval<detail::closure_impl<X...>>()
).get...))
{ return detail::std::forward<F>(f)(static_cast<X&&>(x).get...); }
{ return static_cast<F&&>(f)(static_cast<X&&>(x).get...); }
};

struct placeholder {
template <typename X>
constexpr decltype(auto) operator[](X&& x) const
{ return detail::create<subscript>{}(detail::std::forward<X>(x)); }
{ return detail::create<subscript>{}(static_cast<X&&>(x)); }

template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) const {
return detail::create<invoke>{}(
detail::create<detail::closure>{}(
detail::std::forward<X>(x)...
static_cast<X&&>(x)...
)
);
}
Expand All @@ -139,18 +139,18 @@ namespace boost { namespace hana {
\
template <typename Y, typename ...Z> \
constexpr auto operator()(Y&& y, Z const& ...) const& -> decltype( \
detail::std::declval<X const&>() op detail::std::forward<Y>(y)) \
{ return x op detail::std::forward<Y>(y); } \
detail::std::declval<X const&>() op static_cast<Y&&>(y)) \
{ return x op static_cast<Y&&>(y); } \
\
template <typename Y, typename ...Z> \
constexpr auto operator()(Y&& y, Z const& ...) & -> decltype( \
detail::std::declval<X&>() op detail::std::forward<Y>(y)) \
{ return x op detail::std::forward<Y>(y); } \
detail::std::declval<X&>() op static_cast<Y&&>(y)) \
{ return x op static_cast<Y&&>(y); } \
\
template <typename Y, typename ...Z> \
constexpr auto operator()(Y&& y, Z const& ...) && -> decltype( \
detail::std::declval<X>() op detail::std::forward<Y>(y)) \
{ return detail::std::move(x) op detail::std::forward<Y>(y); } \
detail::std::declval<X>() op static_cast<Y&&>(y)) \
{ return detail::std::move(x) op static_cast<Y&&>(y); } \
}; \
\
template <typename Y> \
Expand All @@ -159,34 +159,34 @@ namespace boost { namespace hana {
\
template <typename X, typename ...Z> \
constexpr auto operator()(X&& x, Z const& ...) const& -> decltype( \
detail::std::forward<X>(x) op detail::std::declval<Y const&>()) \
{ return detail::std::forward<X>(x) op y; } \
static_cast<X&&>(x) op detail::std::declval<Y const&>()) \
{ return static_cast<X&&>(x) op y; } \
\
template <typename X, typename ...Z> \
constexpr auto operator()(X&& x, Z const& ...) & -> decltype( \
detail::std::forward<X>(x) op detail::std::declval<Y&>()) \
{ return detail::std::forward<X>(x) op y; } \
static_cast<X&&>(x) op detail::std::declval<Y&>()) \
{ return static_cast<X&&>(x) op y; } \
\
template <typename X, typename ...Z> \
constexpr auto operator()(X&& x, Z const& ...) && -> decltype( \
detail::std::forward<X>(x) op detail::std::declval<Y>()) \
{ return detail::std::forward<X>(x) op detail::std::move(y); } \
static_cast<X&&>(x) op detail::std::declval<Y>()) \
{ return static_cast<X&&>(x) op detail::std::move(y); } \
}; \
\
struct op_name { \
template <typename X, typename Y, typename ...Z> \
constexpr auto operator()(X&& x, Y&& y, Z const& ...) const -> decltype(\
detail::std::forward<X>(x) op detail::std::forward<Y>(y)) \
{ return detail::std::forward<X>(x) op detail::std::forward<Y>(y); } \
static_cast<X&&>(x) op static_cast<Y&&>(y)) \
{ return static_cast<X&&>(x) op static_cast<Y&&>(y); } \
}; \
\
template <typename X> \
constexpr decltype(auto) operator op (X&& x, placeholder) \
{ return detail::create<op_name ## _left>{}(detail::std::forward<X>(x)); } \
{ return detail::create<op_name ## _left>{}(static_cast<X&&>(x)); } \
\
template <typename Y> \
constexpr decltype(auto) operator op (placeholder, Y&& y) \
{ return detail::create<op_name ## _right>{}(detail::std::forward<Y>(y)); } \
{ return detail::create<op_name ## _right>{}(static_cast<Y&&>(y)); } \
\
inline constexpr decltype(auto) operator op (placeholder, placeholder) \
{ return op_name{}; } \
Expand All @@ -196,8 +196,8 @@ namespace boost { namespace hana {
struct op_name { \
template <typename X, typename ...Z> \
constexpr auto operator()(X&& x, Z const& ...) const \
-> decltype(op detail::std::forward<X>(x)) \
{ return op detail::std::forward<X>(x); } \
-> decltype(op static_cast<X&&>(x)) \
{ return op static_cast<X&&>(x); } \
}; \
\
inline constexpr decltype(auto) operator op (placeholder) \
Expand Down
46 changes: 23 additions & 23 deletions include/boost/hana/functor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ namespace boost { namespace hana {
struct transform_impl<Fun, when<condition>> : default_ {
template <typename Xs, typename F>
static constexpr decltype(auto) apply(Xs&& xs, F&& f) {
return hana::adjust_if(detail::std::forward<Xs>(xs),
return hana::adjust_if(static_cast<Xs&&>(xs),
hana::always(true_),
detail::std::forward<F>(f));
static_cast<F&&>(f));
}
};

Expand All @@ -51,25 +51,25 @@ namespace boost { namespace hana {
struct go {
template <typename F, typename X>
static constexpr decltype(auto) helper(decltype(true_), F&& f, X&& x)
{ return detail::std::forward<F>(f)(detail::std::forward<X>(x)); }
{ return static_cast<F&&>(f)(static_cast<X&&>(x)); }

template <typename F, typename X>
static constexpr X helper(decltype(false_), F&&, X&& x)
{ return detail::std::forward<X>(x); }
{ return static_cast<X&&>(x); }

template <typename F, typename X>
static constexpr decltype(auto) helper(bool cond, F&& f, X&& x) {
return cond ? detail::std::forward<F>(f)(detail::std::forward<X>(x))
: detail::std::forward<X>(x);
return cond ? static_cast<F&&>(f)(static_cast<X&&>(x))
: static_cast<X&&>(x);
}

template <typename Pred, typename F, typename X>
constexpr decltype(auto) operator()(Pred&& pred, F&& f, X&& x) const {
auto cond = hana::if_(detail::std::forward<Pred>(pred)(x),
auto cond = hana::if_(static_cast<Pred&&>(pred)(x),
true_, false_
);
return go::helper(cond, detail::std::forward<F>(f),
detail::std::forward<X>(x));
return go::helper(cond, static_cast<F&&>(f),
static_cast<X&&>(x));
}
};
}
Expand All @@ -78,10 +78,10 @@ namespace boost { namespace hana {
struct adjust_if_impl<Fun, when<condition>> : default_ {
template <typename Xs, typename Pred, typename F>
static constexpr auto apply(Xs&& xs, Pred&& pred, F&& f) {
return hana::transform(detail::std::forward<Xs>(xs),
return hana::transform(static_cast<Xs&&>(xs),
hana::partial(functor_detail::go{},
detail::std::forward<Pred>(pred),
detail::std::forward<F>(f)));
static_cast<Pred&&>(pred),
static_cast<F&&>(f)));
}
};

Expand All @@ -96,9 +96,9 @@ namespace boost { namespace hana {
template <typename Xs, typename Value, typename F>
static constexpr auto apply(Xs&& xs, Value&& value, F&& f) {
return hana::adjust_if(
detail::std::forward<Xs>(xs),
hana::equal.to(detail::std::forward<Value>(value)),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
hana::equal.to(static_cast<Value&&>(value)),
static_cast<F&&>(f)
);
}
};
Expand All @@ -113,9 +113,9 @@ namespace boost { namespace hana {
struct replace_if_impl<Fun, when<condition>> : default_ {
template <typename Xs, typename Pred, typename Value>
static constexpr decltype(auto) apply(Xs&& xs, Pred&& pred, Value&& v) {
return hana::adjust_if(detail::std::forward<Xs>(xs),
detail::std::forward<Pred>(pred),
hana::always(detail::std::forward<Value>(v))
return hana::adjust_if(static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred),
hana::always(static_cast<Value&&>(v))
);
}
};
Expand All @@ -132,9 +132,9 @@ namespace boost { namespace hana {
static constexpr decltype(auto)
apply(Xs&& xs, OldVal&& oldval, NewVal&& newval) {
return hana::replace_if(
detail::std::forward<Xs>(xs),
hana::equal.to(detail::std::forward<OldVal>(oldval)),
detail::std::forward<NewVal>(newval)
static_cast<Xs&&>(xs),
hana::equal.to(static_cast<OldVal&&>(oldval)),
static_cast<NewVal&&>(newval)
);
}
};
Expand All @@ -149,8 +149,8 @@ namespace boost { namespace hana {
struct fill_impl<Fun, when<condition>> : default_ {
template <typename Xs, typename Value>
static constexpr decltype(auto) apply(Xs&& xs, Value&& v) {
return hana::transform(detail::std::forward<Xs>(xs),
hana::always(detail::std::forward<Value>(v))
return hana::transform(static_cast<Xs&&>(xs),
hana::always(static_cast<Value&&>(v))
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/boost/hana/fwd/applicative.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace boost { namespace hana {

template <typename X>
constexpr decltype(auto) operator()(X&& x) const {
return lift_impl<A>::apply(detail::std::forward<X>(x));
return lift_impl<A>::apply(static_cast<X&&>(x));
}
};

Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/fwd/comonad.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace boost { namespace hana {
"hana::extract(w) requires w to be a Comonad");
#endif
return extract_impl<typename datatype<W>::type>::apply(
detail::std::forward<W>(w)
static_cast<W&&>(w)
);
}
};
Expand Down Expand Up @@ -171,7 +171,7 @@ namespace boost { namespace hana {
"hana::duplicate(w) requires w to be a Comonad");
#endif
return duplicate_impl<typename datatype<W>::type>::apply(
detail::std::forward<W>(w)
static_cast<W&&>(w)
);
}
};
Expand Down Expand Up @@ -222,8 +222,8 @@ namespace boost { namespace hana {
"hana::extend(w, f) requires w to be a Comonad");
#endif
return extend_impl<typename datatype<W>::type>::apply(
detail::std::forward<W>(w),
detail::std::forward<F>(f)
static_cast<W&&>(w),
static_cast<F&&>(f)
);
}
};
Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/fwd/comparable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ namespace boost { namespace hana {
return equal_impl<
typename datatype<X>::type, typename datatype<Y>::type
>::apply(
detail::std::forward<X>(x),
detail::std::forward<Y>(y)
static_cast<X&&>(x),
static_cast<Y&&>(y)
);
}

Expand Down Expand Up @@ -293,8 +293,8 @@ namespace boost { namespace hana {
return not_equal_impl<
typename datatype<X>::type, typename datatype<Y>::type
>::apply(
detail::std::forward<X>(x),
detail::std::forward<Y>(y)
static_cast<X&&>(x),
static_cast<Y&&>(y)
);
}

Expand Down
2 changes: 1 addition & 1 deletion include/boost/hana/fwd/core/make.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace boost { namespace hana {
struct _make {
template <typename ...X>
constexpr decltype(auto) operator()(X&& ...x) const {
return make_impl<Datatype>::apply(detail::std::forward<X>(x)...);
return make_impl<Datatype>::apply(static_cast<X&&>(x)...);
}
};

Expand Down
6 changes: 3 additions & 3 deletions include/boost/hana/fwd/either.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ namespace boost { namespace hana {
struct _either {
template <typename F, typename G, typename E>
constexpr decltype(auto) operator()(F&& f, G&& g, E&& e) const {
return detail::std::forward<E>(e).go(
detail::std::forward<F>(f),
detail::std::forward<G>(g)
return static_cast<E&&>(e).go(
static_cast<F&&>(f),
static_cast<G&&>(g)
);
}
};
Expand Down
4 changes: 2 additions & 2 deletions include/boost/hana/fwd/enumerable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace boost { namespace hana {

return succ_impl<
typename datatype<E>::type
>::apply(detail::std::forward<E>(num));
>::apply(static_cast<E&&>(num));
}
};

Expand Down Expand Up @@ -116,7 +116,7 @@ namespace boost { namespace hana {

return pred_impl<
typename datatype<E>::type
>::apply(detail::std::forward<E>(num));
>::apply(static_cast<E&&>(num));
}
};

Expand Down
86 changes: 43 additions & 43 deletions include/boost/hana/fwd/foldable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ namespace boost { namespace hana {
#endif

return foldl_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<State>(state),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<State&&>(state),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -168,9 +168,9 @@ namespace boost { namespace hana {
"hana::foldlM<M>(xs, state, f) requires xs to be Foldable");
#endif
return foldlM_impl<typename datatype<Xs>::type>::template apply<M>(
detail::std::forward<Xs>(xs),
detail::std::forward<State>(state),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<State&&>(state),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -219,9 +219,9 @@ namespace boost { namespace hana {
#endif

return foldr_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<State>(state),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<State&&>(state),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -274,9 +274,9 @@ namespace boost { namespace hana {
"hana::foldrM<M>(xs, state, f) requires xs to be Foldable");
#endif
return foldrM_impl<typename datatype<Xs>::type>::template apply<M>(
detail::std::forward<Xs>(xs),
detail::std::forward<State>(state),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<State&&>(state),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -322,8 +322,8 @@ namespace boost { namespace hana {
"hana::foldr1(xs, f) requires xs to be Foldable");
#endif
return foldr1_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -368,8 +368,8 @@ namespace boost { namespace hana {
"hana::foldl1(xs, f) requires xs to be Foldable");
#endif
return foldl1_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -413,15 +413,15 @@ namespace boost { namespace hana {
struct _fold {
template <typename Xs, typename S, typename F>
constexpr decltype(auto) operator()(Xs&& xs, S&& s, F&& f) const {
return hana::foldl(detail::std::forward<Xs>(xs),
detail::std::forward<S>(s),
detail::std::forward<F>(f));
return hana::foldl(static_cast<Xs&&>(xs),
static_cast<S&&>(s),
static_cast<F&&>(f));
}

template <typename Xs, typename F>
constexpr decltype(auto) operator()(Xs&& xs, F&& f) const {
return hana::foldl1(detail::std::forward<Xs>(xs),
detail::std::forward<F>(f));
return hana::foldl1(static_cast<Xs&&>(xs),
static_cast<F&&>(f));
}
};

Expand Down Expand Up @@ -469,15 +469,15 @@ namespace boost { namespace hana {
struct _reverse_fold {
template <typename Xs, typename S, typename F>
constexpr decltype(auto) operator()(Xs&& xs, S&& s, F&& f) const {
return hana::foldr(detail::std::forward<Xs>(xs),
detail::std::forward<S>(s),
hana::flip(detail::std::forward<F>(f)));
return hana::foldr(static_cast<Xs&&>(xs),
static_cast<S&&>(s),
hana::flip(static_cast<F&&>(f)));
}

template <typename Xs, typename F>
constexpr decltype(auto) operator()(Xs&& xs, F&& f) const {
return hana::foldr1(detail::std::forward<Xs>(xs),
hana::flip(detail::std::forward<F>(f)));
return hana::foldr1(static_cast<Xs&&>(xs),
hana::flip(static_cast<F&&>(f)));
}
};

Expand Down Expand Up @@ -531,8 +531,8 @@ namespace boost { namespace hana {
"hana::for_each(xs, f) requires xs to be Foldable");
#endif
return for_each_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -572,7 +572,7 @@ namespace boost { namespace hana {
"hana::length(xs) requires xs to be Foldable");
#endif
return length_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -632,8 +632,8 @@ namespace boost { namespace hana {
"hana::minimum_by(pred, xs) requires xs to be Foldable");
#endif
return minimum_by_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Pred>(pred),
detail::std::forward<Xs>(xs)
static_cast<Pred&&>(pred),
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -670,7 +670,7 @@ namespace boost { namespace hana {
#endif

return minimum_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -717,8 +717,8 @@ namespace boost { namespace hana {
#endif

return maximum_by_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Pred>(pred),
detail::std::forward<Xs>(xs)
static_cast<Pred&&>(pred),
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -755,7 +755,7 @@ namespace boost { namespace hana {
#endif

return maximum_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -797,7 +797,7 @@ namespace boost { namespace hana {
#endif

return sum_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -838,7 +838,7 @@ namespace boost { namespace hana {
"hana::product(xs) requires xs to be Foldable");
#endif
return product_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -887,8 +887,8 @@ namespace boost { namespace hana {
"hana::count_if(xs, pred) requires xs to be Foldable");
#endif
return count_if_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Pred>(pred)
static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred)
);
}
};
Expand Down Expand Up @@ -934,8 +934,8 @@ namespace boost { namespace hana {
"hana::count(xs, value) requires xs to be Foldable");
#endif
return count_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Value>(value)
static_cast<Xs&&>(xs),
static_cast<Value&&>(value)
);
}
};
Expand Down Expand Up @@ -991,8 +991,8 @@ namespace boost { namespace hana {
"hana::unpack(xs, f) requires xs to be Foldable");
#endif
return unpack_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<F&&>(f)
);
}
};
Expand Down
32 changes: 16 additions & 16 deletions include/boost/hana/fwd/functor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ namespace boost { namespace hana {
#endif

return transform_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -213,9 +213,9 @@ namespace boost { namespace hana {
"hana::adjust_if(xs, pred, f) requires xs to be a Functor");
#endif
return adjust_if_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Pred>(pred),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -272,9 +272,9 @@ namespace boost { namespace hana {
"hana::adjust(xs, value, f) requires xs to be a Functor");
#endif
return adjust_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Value>(value),
detail::std::forward<F>(f)
static_cast<Xs&&>(xs),
static_cast<Value&&>(value),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -330,9 +330,9 @@ namespace boost { namespace hana {
"hana::replace_if(xs, pred, value) requires xs to be a Functor");
#endif
return replace_if_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Pred>(pred),
detail::std::forward<Value>(value)
static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred),
static_cast<Value&&>(value)
);
}
};
Expand Down Expand Up @@ -385,9 +385,9 @@ namespace boost { namespace hana {
"hana::replace(xs, oldval, newval) requires xs to be a Functor");
#endif
return replace_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<OldVal>(oldval),
detail::std::forward<NewVal>(newval)
static_cast<Xs&&>(xs),
static_cast<OldVal&&>(oldval),
static_cast<NewVal&&>(newval)
);
}
};
Expand Down Expand Up @@ -437,8 +437,8 @@ namespace boost { namespace hana {
"hana::fill(xs, value) requires xs to be a Functor");
#endif
return fill_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Value>(value)
static_cast<Xs&&>(xs),
static_cast<Value&&>(value)
);
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/boost/hana/fwd/group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ namespace boost { namespace hana {
return minus_impl<
typename datatype<X>::type, typename datatype<Y>::type
>::apply(
detail::std::forward<X>(x),
detail::std::forward<Y>(y)
static_cast<X&&>(x),
static_cast<Y&&>(y)
);
}
};
Expand All @@ -187,7 +187,7 @@ namespace boost { namespace hana {
template <typename X>
constexpr decltype(auto) operator()(X&& x) const {
return negate_impl<typename datatype<X>::type>::apply(
detail::std::forward<X>(x)
static_cast<X&&>(x)
);
}
};
Expand Down
8 changes: 4 additions & 4 deletions include/boost/hana/fwd/integral_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ namespace boost { namespace hana {
return quot_impl<
typename datatype<X>::type, typename datatype<Y>::type
>::apply(
detail::std::forward<X>(x),
detail::std::forward<Y>(y)
static_cast<X&&>(x),
static_cast<Y&&>(y)
);
}
};
Expand Down Expand Up @@ -200,8 +200,8 @@ namespace boost { namespace hana {
return rem_impl<
typename datatype<X>::type, typename datatype<Y>::type
>::apply(
detail::std::forward<X>(x),
detail::std::forward<Y>(y)
static_cast<X&&>(x),
static_cast<Y&&>(y)
);
}
};
Expand Down
24 changes: 12 additions & 12 deletions include/boost/hana/fwd/iterable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ namespace boost { namespace hana {
"hana::head(xs) requires xs to be an Iterable");
#endif
return head_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -218,7 +218,7 @@ namespace boost { namespace hana {
"hana::tail(xs) requires xs to be an Iterable");
#endif
return tail_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -253,7 +253,7 @@ namespace boost { namespace hana {
#endif

return is_empty_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -305,8 +305,8 @@ namespace boost { namespace hana {
"hana::at(n, xs) requires xs to be an Iterable");
#endif
return at_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<N>(n),
detail::std::forward<Xs>(xs)
static_cast<N&&>(n),
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -365,7 +365,7 @@ namespace boost { namespace hana {
"hana::last(xs) requires xs to be an Iterable");
#endif
return last_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs)
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -418,8 +418,8 @@ namespace boost { namespace hana {
"hana::drop(n, xs) requires xs to be an Iterable");
#endif
return drop_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<N>(n),
detail::std::forward<Xs>(xs)
static_cast<N&&>(n),
static_cast<Xs&&>(xs)
);
}
};
Expand Down Expand Up @@ -493,8 +493,8 @@ namespace boost { namespace hana {
"hana::drop_while(xs, pred) requires xs to be an Iterable");
#endif
return drop_while_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Pred>(pred)
static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred)
);
}
};
Expand Down Expand Up @@ -553,8 +553,8 @@ namespace boost { namespace hana {
"hana::drop_until(xs, pred) requires xs to be an Iterable");
#endif
return drop_until_impl<typename datatype<Xs>::type>::apply(
detail::std::forward<Xs>(xs),
detail::std::forward<Pred>(pred)
static_cast<Xs&&>(xs),
static_cast<Pred&&>(pred)
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/boost/hana/fwd/lazy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace boost { namespace hana {
template <typename Expr>
constexpr decltype(auto) operator()(Expr&& expr) const {
return eval_impl<typename datatype<Expr>::type>::apply(
detail::std::forward<Expr>(expr)
static_cast<Expr&&>(expr)
);
}
};
Expand Down
26 changes: 13 additions & 13 deletions include/boost/hana/fwd/logical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ namespace boost { namespace hana {
"hana::if_(cond, then, else) requires cond to be a Logical");
#endif
return if_impl<typename datatype<Cond>::type>::apply(
detail::std::forward<Cond>(cond),
detail::std::forward<Then>(then),
detail::std::forward<Else>(else_)
static_cast<Cond&&>(cond),
static_cast<Then&&>(then),
static_cast<Else&&>(else_)
);
}
};
Expand Down Expand Up @@ -318,9 +318,9 @@ namespace boost { namespace hana {
"hana::eval_if(cond, then, else) requires cond to be a Logical");
#endif
return eval_if_impl<typename datatype<Cond>::type>::apply(
detail::std::forward<Cond>(cond),
detail::std::forward<Then>(then),
detail::std::forward<Else>(else_)
static_cast<Cond&&>(cond),
static_cast<Then&&>(then),
static_cast<Else&&>(else_)
);
}
};
Expand Down Expand Up @@ -386,9 +386,9 @@ namespace boost { namespace hana {
"hana::while_(pred, state, f) requires pred(state) to be a Logical");
#endif
return while_impl<typename datatype<Cond>::type>::apply(
detail::std::forward<Pred>(pred),
detail::std::forward<State>(state),
detail::std::forward<F>(f)
static_cast<Pred&&>(pred),
static_cast<State&&>(state),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -447,9 +447,9 @@ namespace boost { namespace hana {
"hana::until(pred, state, f) requires pred(state) to be a Logical");
#endif
return until_impl<typename datatype<Cond>::type>::apply(
detail::std::forward<Pred>(pred),
detail::std::forward<State>(state),
detail::std::forward<F>(f)
static_cast<Pred&&>(pred),
static_cast<State&&>(state),
static_cast<F&&>(f)
);
}
};
Expand Down Expand Up @@ -481,7 +481,7 @@ namespace boost { namespace hana {
template <typename X>
constexpr decltype(auto) operator()(X&& x) const {
return not_impl<typename datatype<X>::type>::apply(
detail::std::forward<X>(x)
static_cast<X&&>(x)
);
}
};
Expand Down
Loading