In order to understand how to use initializer_list, I'm writing a constructor of my own to fill a vector of integers (explanations here) :
#include <vector>
class X
{
std::vector< int > *vec;
public:
X(std::initializer_list<int>);
};
X(std::initializer_list<int> values)
{
this->vec = new std::vector<int>(values);
}
The line
X(std::initializer_list<int> values)
is rejected by my g++ -std=c++11 : invalid declarator before values. Why ?