> On Saturday, December 27, 2014 11:27:32 PM UTC+1, Jens Müller wrote:
>> On 27.12.2014 22:28,
jono...@googlemail.com wrote:
>> > Because as it happens, I'm working with a derived vector, that
>> > handles
> pointers and automatically deletes them in the destructor. And
> "SURPRISE": I have to also overload 'erase' to also do deletes! And
> other stuff as well... probably. Which is exactly what you say in the
> rationale.
>>
>> Then a better solution is probably to use a normal std::vector and
>> put suitable smart pointers (e.g. std::unique_ptr) into it.
>
> Challange: try that suggestion of yours using std::unique_ptr
> ;)
>
>
> Here's a solution (no peeking!):
>
>
> ///////////////////////////////////////
>
> #include <vector>
> #include <memory>
> #include <initializer_list>
>
>
> using std::vector;
>
> template<typename T>
> struct pvector : public vector<std::unique_ptr<T>>{