Either a functor class satisfying the extended requirements for unary operations, or an untyped template of such a class wrapped into BuildUnary or BuildUnaryIt (preferably expressed via the convenience typedef from namespace polymake::operations.
Either a functor class satisfying the extended requirements for binary operations, or an untyped template of such a class wrapped into BuildBinary or BuildBinaryIt (preferably expressed via the convenience typedef from namespace polymake::operations.
template <typename Iterator, typename Operation> void perform_assign(Iterator dst, Operation op);
Apply the assign() method of the unary operation to each element in a sequence.
dst must be end_sensitive.
template <typename Iterator1, typename Iterator2, typename Operation> void perform_assign (Iterator1 dst, Iterator2 src2, Operation op);
Apply the assign() method of the binary operation to each element in a sequence.
dst must be end_sensitive. src2 supplies the second operands.
template <typename Iterator, typename Operation, typename Object> Object& accumulate_in(Iterator src, Operation op, Object& x);
Apply the assign() method of the binary operation to x, consequently using all elements supplied by src as the second operands. Return the reference to x.
src must be end_sensitive.
template <typename Container, typename Operation> typename Container::value_type accumulate(const Container& c, Operation op);
Initialize an object with the first element of c, then apply the assign() method of the binary operation consecutively using the rest of c as the second operands, and return it. If c is empty, return an object created with the default constructor.
For example, accumulate(c, operations::mul()) computes the product of all elements in c, and accumulate(c, operations::max()) finds the greatest element.
template <typename Container> typename Container::value_type average(const Container& c);
Accumulate the sum of all elements in c and divide it thru c.size(). For empty containers will probably trigger a "zero division" trap.

### Overloaded STL algortihms

Polymake Template Library has overloaded a couple of most often used STL algorithms with versions adapted for end_sensitive iterators. In principle, almost every STL algorithm could be adapted this way, but this would mean an almost complete rewrite of the STL! Thus, we create the adapted versions only when acute need arises.

template <typename Iterator1, typename Iterator2> Iterator2 std::copy(Iterator1 src, Iterator2 dst); template <typename Iterator1, typename Iterator2> void std::swap_ranges(Iterator1 it1, Iterator2 it2);
At least one of iterators must be end_sensitive. If both are, the algorithm is terminated as soon as one of them has reached the at_end state.
copy returns the destination iterator pointing after the last copied data item.
template <typename Iterator> void std::iter_swap(Iterator it1, Iterator it2);
This specialization makes use of the std::swap function, which is optimized for many data types. The original STL variant allows two different iterator types, and therefore falls back to the less optimal copying via temporary object.
template <typename Iterator, typename Value> void std::fill(Iterator dst, const Value& value);
dst must be end_sensitive.
template <typename Iterator, typename Predicate> Iterator std::find_if(Iterator src, Predicate pred);
src must be end_sensitive.
Predicate::result_type must be bool or something convertible to it.
template <typename Iterator1, typename Iterator2> bool std::equal(Iterator1 it1, Iterator2 it2);
At least one of iterators must be end_sensitive. The elements of the data sequences are compared unless one of iterators reaches the at_end state.