Thursday, April 9, 2015

How do I define an in-class constant?

If you want a constant that you can use in a compile time constant expression, say as an array bound, use constexpr if your compiler supports that C++11 feature, otherwise you have two other choices:

You have more flexibility if the constant isn’t needed for use in a compile time constant expression:

You can take the address of a static member if (and only if) it has an out-of-class definition:


  1. Your blog is very attractive and informative keep blogging.
    Published here

  2. If you might be} new to ordering 3D printing services – don’t worry Stylus Pens – we make it easy! We are pleased to reply your questions and will allow you to get the best print in your needed utility. From prototypes to planes – 3D Scanning Services can seize and digitize your project for inspection, 3D printing, rapid design iteration or any CAD associated tasks.