7.5.6

来源:互联网 发布:电子相册网站源码 编辑:程序博客网 时间:2024/06/07 14:07

7.53

class Debug {public:    constexpr Debug(bool b = true) : rt(b), io(b), other(b) { }    constexpr Debug(bool r, bool i, bool o) : rt(r), io(i), other(0) { }    constexpr bool any() { return rt || io || other; }    void set_rt(bool b) { hw = b; }    void set_io(bool b) { io = b; }    void set_other(bool b) { other = b; }private:    bool hw;            bool io;            bool other;    };

7.54(转)
in C++11, constexpr member functions are implicitly const, so the “set_xx” functions, which will modify data members, cannot be declared as constexpr. In C++14, this property no longer holds, so constexpr is suitable.

7.55
不是
string不是字面值常量

0 0
原创粉丝点击