开发者

Simple Constructor Initialization List

I want to开发者_开发问答 initialize one of the class variables to max of unsigned long long with something like this:

ClassA():
 maxvalue(std::numeric_limits<unsigned long long>::max())
{

}

Is it ok to do this? Can I use

std::numeric_limits<unsigned long long>::max()

in the intialization list?


Yes. This will work as long as maxvalue is able to be constructed from std::numeric_limits<unsigned long long>::max().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜