# Array clear() doesn't call destructor of class?

**URL:** <https://forum.juce.com/t/array-clear-doesnt-call-destructor-of-class/6657>\
**Category:** General JUCE discussion\
**Created:** [April 1, 2011, 2:40pm UTC](https://forum.juce.com/t/array-clear-doesnt-call-destructor-of-class/6657 "2011-04-01T14:40:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PieterS](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pieters/32/10588_2.png) [@PieterS](https://forum.juce.com/u/PieterS)\
**Post date:** [April 1, 2011, 2:40pm UTC](https://forum.juce.com/t/array-clear-doesnt-call-destructor-of-class/6657/1 "2011-04-01T14:40:37Z")

</div>

On an array like this:

```auto

```

why does clear() not call the destructor of the MyClass?

while in this case:

```auto

```

it does?

---

<div class="post-metadata">

**Author:** ![TheVinn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thevinn/32/806_2.png) [@TheVinn](https://forum.juce.com/u/TheVinn)\
**Post date:** [April 1, 2011, 2:46pm UTC](https://forum.juce.com/t/array-clear-doesnt-call-destructor-of-class/6657/2 "2011-04-01T14:46:31Z")

</div>

Pointers don’t have destructors.

I think you want to use OwnedArray.
