why can't push static const member into vector?
static const, static const constexpr, can't push into static, non-static, and static const outside class, can push sorry. I missed scope specifier , well I mean the situation that added specifier, can’t push static const member
struct A {
static const constexpr int sccv = 0;
static const int scv = 0;
static int sv = 0;
const int cv = 0;
};
int main () {
std::vector<int> vec;
vec.push_back(A::sccv); // error
vec.push_back(A::scv); // error
vec.push_back(A::sv); // pass
vec.push_back((new A())->cv); // pass
static const int sc = 0;
vec.push_back(sc); // pass
}