Consider
int array[5]{};
std::cout << std::size(array) << std::endl;
This will give me the result of 5.
int array[5]{};
std::cout << sizeof(array) << std::endl;
This will give me the result of 20.
Why is that? What is the difference on size and sizeof?
std::sizeisconstexprin modern C++, it makes the impression to supersedesizeof. When should we still usesizeofinsteadstd::size? What are the pros and cons?sizeofand a quick search wouldn't have hurt. Not sure what I was asking exactly. "Move along, nothing to see here" :D