8 #ifndef INCLUDE_TEMPLE_FUNCTOR_H
9 #define INCLUDE_TEMPLE_FUNCTOR_H
16 namespace Molassembler {
29 return std::forward<U>(v);
38 template<
class Container>
43 using ContainerBinding::ContainerBinding;
48 return ContainerBinding::value.at(index);
57 template<
class Container>
63 template<
class Container>
68 using ContainerBinding::ContainerBinding;
79 std::begin(ContainerBinding::value),
80 std::end(ContainerBinding::value),
84 if(findIter == std::end(ContainerBinding::value)) {
85 throw std::out_of_range(
"Item not found in container");
88 return findIter - std::begin(ContainerBinding::value);
97 template<
class Container>
108 return std::get<i>(t);
120 constexpr
auto get() {
return Get<i> {}; }
128 template<
typename UnaryF,
typename UnaryG>
130 Currier(UnaryF&& outer, UnaryG&& inner) : f(outer), g(inner) {}
133 auto operator() (T&& t) -> decltype(
auto) {
141 template<
typename UnaryF,
typename UnaryG>
142 auto curry(UnaryF&& outer, UnaryG&& inner) {
constexpr auto operator()(const T &t) const
Call std::get<i> on the argument.
Definition: Functor.h:107
auto at(Container &&container)
Make functor calling at on arguments.
Definition: Functor.h:58
Provides an identity functor.
constexpr Get< 1 > second
Calls std::get<1> on any argument it is invoked with.
Definition: Functor.h:125
Metafunction required for default arguments.
Definition: Functor.h:25
Metafunction calling at on a bound container.
Definition: Functor.h:39
Metafunction determining the index of an item in a bound container.
Definition: Functor.h:64
Definition: Functor.h:129
constexpr Get< 0 > first
Calls std::get<0> on any argument it is invoked with.
Definition: Functor.h:123
constexpr auto operator()(U &&v) const noexcept
Returns its arguments (perfect forwarding)
Definition: Functor.h:28
auto operator()(const T &item) const
Determine index of an item in the container.
Definition: Functor.h:77
Type that will own rvalues, reference lvalues.
Definition: Binding.h:37
auto operator()(const T &index) const
Return value in container at specified position.
Definition: Functor.h:47
Metafunction calling std::get on an argument with a bound index.
Definition: Functor.h:104
auto indexIn(Container &&container)
Make functor determining the index of an item in a bound container.
Definition: Functor.h:98
auto find(const Container &container, const T &needle)
std::find shorthand
Definition: Functional.h:346