title: Can I tell the size of an array created with "new type[n]" in C++?
body: <p>Using C++11, I like to create an array of booleans and immediately clear it</p>
  
  <pre><code>bool *mymap = new bool[n];
  </code></pre>
  
  <p>n is variable.</p>
  
  <p>Now, does this already clear the memory occupied by the array? If not, is there a better approach to clear the array than using a loop over all elements, setting each to false individually?</p>
  
  <p>I considered using std:memset(), but that requires me to know the size of the array. Now, beginners might say: Easy, the size is n*sizeof(bool). But I don't buy that. The compiler might decide to pack them differently, even pack them as bits, couldn't it?</p>
  
  <p>So, is there a way to tell the size of the array more cleanly? I imagine there might be a std:arraysize() function that simply returns the space of the allocated array in memory. After all, that information must be maintained at runtime somehow, or a delete invocation wouldn't know how much to release, right?</p>