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