# What means "Type Erasure" --- ## Example Scenario Consider a Template Funktion like this: ``` template
void copy_upto(InIt b, InIt e, OutIt t, Predicate c) { while (b != e) { const auto v{*b++;} *t++ = v; if (c(v)) break; } } ``` It needs to be called with four arguments: * The first two may have any type formally named ``InIt``. * The third may have any type formally named ``OutIt``. * The fourth may have any type formally named ``Predicate``. Really any type? --- ## Type restrictions Restrictions on the types come from the use of the arguments: * ``InIt`` must support the following operations * Comparision (``operator!=``) * Post-Increment (``operaror++(int)``) * Dereference (``operator*``) to a type that is copy-constructable * ``OutIt`` must support the following operations * Post-Increment (``operaror++(int)``) * Dereference (``operator*``) to a type that is a copy-assignable Lvalue * ``Predicate`` must be something that ... * ... can be called like a function ... * ... with an argument type compatible to ``InIt`` dereferenced ---