I'm looking for a solution that how can I find the one dimension array which does not contain any elements. I had done so far some following codes which pretty code, but it will be good if there is any other solution for it.
Code_01
#include <iostream>
#include <list>
using namespace std;
int main()
{
list<int> mylist{};
if (mylist.empty()) {
cout << "True";
}
else {
cout << "False";
}
return 0;
}
Code_03
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> myvector{};
if (myvector.empty()) {
cout << "True";
}
else {
cout << "False";
}
return 0;
}