Pergunta

I'm reading the book C++ Primer 5th Edition. On Page 477 a function get_size() is used to allocate an array of int , as pasted below.

// call get_size to determine how many ints to allocate
int *pia = new int[get_size()]; // pia points to the first of these ints 

I have tried:

#include <new>
#include <memory>

but didn't work. I googled this function as well, but still in vain.Which header should I include before it can be used in my code?

Foi útil?

Solução

get_size() should be an user defined function here. Don't need to waste your time finding its header.

Outras dicas

That's just a random thing the book used as a example of the type of information to pass to new, e.g., the amount of the memory to allocate. It's not an actual function, at least not in the standard library.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top