You ask, when can the result of construction be used in a context that requires constant expression? For example.
class A {
constexpr A(...) { ... };
constexpr int get() { ... };
...
}
constexpr A a(...);
std::array<double, a.get()> x{};
, ? std::array (http://en.cppreference.com/w/cpp/language/constant_expression) integer, get is constexpr, a constexpr. , constexpr ( , : http://en.cppreference.com/w/cpp/language/constexpr). , a ( , "constexpr" ), , , , , constexpr.
:
struct A {
constexpr A(int x) : m_x(x) {};
constexpr int get() { return m_x; }
int m_x;
};
int main(int, char**)
{
constexpr int x = 5;
constexpr A a(x);
std::array<double, a.get()> y;
return 0;
}
, x constexpr const, . , constexpr, , , a , , a.get() . , , : - , , . , ( ) constexpr, , ( 5, constexpr).