a n
a n

Reputation: 127

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?

Upvotes: 0

Views: 138

Answers (1)

Mankarse
Mankarse

Reputation: 40643

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

Upvotes: 2

Related Questions