0

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?

2
  • 2
    What exactly is preventing you from trying this? Commented Oct 10, 2011 at 14:40
  • @KerrekSB: the fact that many operations are subtly and silently undefined in C++? Commented Oct 10, 2011 at 15:13

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.