It is a side effect of replacement while block with std::for_each. Last parameter of std::for_each needs a function object, std::default_delete just fits it.