Boost.Hana  1.0.0
Your standard library for metaprogramming
boost::hana::detail::nested_by< Algorithm > Struct Template Reference


template<typename Algorithm>
struct boost::hana::detail::nested_by< Algorithm >

Provides a .by static constexpr function object.

When creating a binary function object of type Algorithm whose signature is Object x Predicate -> Return, nested_by<Algorithm> can be used as a base class to Algorithm. Doing so will provide a static constexpr member called by, which has the two following signatures:

Predicate x Object -> Return
Predicate -> (Object -> Return)

In other words, nested_by is a curryed and flipped version of Algorithm. Note that the function object Algorithm must be default-constructible, since the algorithm will be called as Algorithm{}(arguments...).

This function object is especially useful because it takes care of avoiding ODR violations caused by the nested static constexpr member.