I'm trying to get a simple delete every pointer in my vector/list/... function written with an ultra cool lambda function. Mind you, I don't know c**p about those things :)
template <typename T>
void delete_clear(T const& cont)
{
for_each(T.begin(), T.end(), [](???){ ???->delete() } );
}
I have no clue what to fill in for the ???'s. Any help is greatly appreciated!
UPDATE: This is what it should look like:
template <typename Container>
void delete_clear(Container &c)
{
for_each(c.begin(), c.end(), [](typename Container::value_type x){ delete x; } );
c.clear();
}