Exception Handling with pointer [closed]

Assuming you have enough memory:

try {
    std::vector<std::vector<double>> vec(5000000, std::vector<double>(5000000));
    // …
} catch (std::bad_alloc const& e) {
    // …
}

Browse More Popular Posts

Leave a Comment