I am trying to define a class constructor which takes and initializer_list parameter and use it to construct the contained vector.
//header template<typename VertexType, typename IndexType> class Mesh { public: Mesh(std::initializer_list<VertexType> vertices); private: std::vector<VertexType> mVertexData; }; // cpp template<typename VertexType, typename IndexType> Mesh<VertexType, IndexType>::Mesh(std::initializer_list<VertexType> vertices) { mVertexData(vertices); } The compilation fails with the following error:
error: no match for call to '(std::vector<Vertex, std::allocator<Vertex> >) (std::initializer_list<NRK::Vertex>&)' mVertexData(vertices); Not sure what I am doing wrong. Any hint?
I am compiling on Windows using QTCreator 5.4.2 and MinGW.