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

Description

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...).

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