8 #ifndef INCLUDE_MOLASSEMBLER_TEMPLE_TRANSFORM_ADAPTOR_H
9 #define INCLUDE_MOLASSEMBLER_TEMPLE_TRANSFORM_ADAPTOR_H
16 namespace Molassembler {
21 template<
class Container,
typename UnaryFunction>
25 using BoundContainer =
typename Binding<Container>::type;
27 using ContainerValueType = decltype(
29 std::declval<const Container>()
33 using ReturnType = decltype(
35 std::declval<UnaryFunction>(),
36 std::declval<ContainerValueType>()
40 using ContainerIteratorType = decltype(std::begin(std::declval<const Container>()));
45 BoundContainer container;
46 UnaryFunction
function;
53 UnaryFunction&& passFunction
54 ) : container(std::forward<
Container>(passContainer)),
55 function(passFunction)
62 Traits::hasSize<Container>::value,
65 return container.size();
73 const Transformer* basePtr_;
74 ContainerIteratorType iter_;
77 using iterator_category = std::forward_iterator_tag;
78 using value_type = ReturnType;
79 using difference_type = int;
80 using pointer =
const ReturnType*;
81 using reference =
const ReturnType&;
85 const Transformer& base,
86 ContainerIteratorType&& iter
91 iterator& operator ++ () {
96 iterator operator ++ (
int) {
97 iterator prior = *
this;
102 bool operator == (
const iterator& other)
const {
103 return iter_ == other.iter_;
106 bool operator != (
const iterator& other)
const {
107 return !(*
this == other);
110 ReturnType operator * ()
const {
115 iterator begin()
const {
118 std::begin(container)
122 iterator end()
const {
133 template<
class Container,
typename UnaryFunction>
136 UnaryFunction&&
function
138 return Detail::Transformer<Container, UnaryFunction>(
139 std::forward<Container>(container),
140 std::forward<UnaryFunction>(
function)
Uniform callable invoke from arguments or tuple of arguments.
Provides an identity functor.
unsigned size(Shape shape)
Fetch the number of vertices of a shape.
Compile-time container type traits.
auto invoke(Function &&function, const boost::tuples::cons< HT, TT > &tuple)
Invokes a function with all values in a given boost tuple.
Definition: Invoke.h:44