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()
.
精彩评论