I'm trying to initialize a vector holding Node objects with a specific size. The code:
std::vector<Node> vertices(500);
produces the following errors:
In constructor ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = Node; _Alloc = std::allocator<Node>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = Node; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<Node>]’:
test.cpp:47:36: error: no matching function for call to ‘Node::Node()’
std::vector<Node> vertices(500);
^
test.cpp:47:36: note: candidates are:
test.cpp:13:3: note: Node::Node(unsigned int)
Node(unsigned int label) : m_label(label), degree(0) {}
^
test.cpp:13:3: note: candidate expects 1 argument, 0 provided
test.cpp:7:7: note: Node::Node(const Node&)
class Node {
^
test.cpp:7:7: note: candidate expects 1 argument, 0 provided
test.cpp:47:36: note: when instantiating default argument for call to std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = Node; _Alloc = std::allocator<Node>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = Node; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<Node>]
std::vector<Node> vertices(500);