阅读背景:

如何防止从int到无符号int的隐式转换?

来源:互联网 

Suppose you have this:

假设你有:

struct Foo {
    Foo(unsigned int x) : x(x) {}
    unsigned int x;
};

int main() {
    Foo f = Foo(-1);     // how to get a compiler error here?
    std::cout << f.x << std::endl;
}
struct Foo {
 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: