Will following C++ code be standard compliant if size remains 0?
std::size_t size = 0;
//... some code that may change size
auto foo = std::vector<int>(size);
Or do I have to resort to something like this:
std::size_t size = 0;
//... some code that may change size
auto foo = [size]() {
if (size > 0) return std::vector<int>(size);
else return std::vector<int>();
}();
Aucun commentaire:
Enregistrer un commentaire