As we can see from the below code that the maximum element in the array are the same as that of size. I was expecting the size
will return me the 2 elements only.
#include <array>
#include <iostream>
enum class x
{
a = 1,
b = 2,
c = 3
};
int main()
{
std::array<x, 3> nums {x::a, x::b};
std::cout << "nums contains " << nums.size() << " elements.\n";
std::cout << "max nums contains " << nums.max_size() << " elements.\n";
}
Result:
nums contains 3 elements.
max nums contains 3 elements.
Aucun commentaire:
Enregistrer un commentaire