33 #include <boost/optional.hpp> 113 return detail::IsFunctorImpl<T> (0);
123 template<
typename T,
typename F>
146 template<
typename T,
typename F,
typename = std::enable_if_t<IsFunctor<T> ()>>
172 template<
typename T,
typename F>
173 auto operator* (
const F&
function,
const T& functor) -> decltype (
Fmap (functor,
function))
175 return Fmap (functor,
function);
198 template<
typename T,
typename F>
199 auto operator* (
const T& functor,
const F&
function) -> decltype (
Fmap (functor,
function))
201 return Fmap (functor,
function);
218 using FmapResult_t = boost::optional<std::decay_t<std::result_of_t<F (T)>>>;
226 return { std::invoke (
f, *t) };
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptr > > f
auto operator*(const AF &af, const AV &av) -> decltype(GSL(af, av))
static FmapResult_t< F > Apply(const T &functor, const F &function)
Applies the function to the each of the elements inside the functor.
boost::optional< std::decay_t< std::result_of_t< F(T)> >> FmapResult_t
constexpr bool IsFunctorImpl(int, typename InstanceFunctor< T >::UndefinedTag *=nullptr)
constexpr bool IsFunctor()
Checks whether the given type has a Functor instance for it.
FmapResult_t< T, F > Fmap(const T &functor, const F &function)
Apply the function f to the elements in functor.
static FmapResult_t< F > Apply(const boost::optional< T > &t, const F &f)
typename InstanceFunctor< T >::template FmapResult_t< F > FmapResult_t
The result type of the contents of the functor T mapped by function F.
The Functor class is used for types that can be mapped over.
detail::ImplementationType FmapResult_t
The type of the functor after its elements were mapped by the function F.