C++ 对于抛出运行时错误的写法

简介

C++知道有一个类似python的运行时错误的写法一直没有写过,参考别人的代码的方案。

code

//关于颜色的判定
    if ((r < 0.0) || (r > 255.) || (g < 0.0) || (g > 255.) || (b < 0.0) ||
        (b > 255.)) {
        throw std::runtime_error("Invalid color values");
    }
Hope is a good thing,maybe the best of things,and no good thing ever dies.----------- Andy Dufresne
原文地址:https://www.cnblogs.com/eat-too-much/p/12463309.html