template <typename T>
T sq(T x)
{
	return x∗x;
}

template <typename Container, typename F>
void apply(Container& c, F f)
{
	for(auto& x: c)
	{
		x = f(x);
	}
}

int main(...)
{
	std::vector<int> v = { 1, 2, 3 };
	apply(v, sq<int>); // now v == { 1, 4, 9 }
}