Wats wrong with this?
std::vector<std::set<unsigned long> > surroundings;
std::set<unsigned long> empty ();
X = std::vector<std::set<unsigned long> > (N,empty);
(where N is an ulong)
Wats wrong with this?
std::vector<std::set<unsigned long> > surroundings;
std::set<unsigned long> empty ();
X = std::vector<std::set<unsigned long> > (N,empty);
(where N is an ulong)
The compiler will treat this statement:
std::set<unsigned long> empty ();
as a function declaration. It will think that you are declaring a function that takes no parameters are returns a set of ulongs. To declare a default-constructed object, just use this:
std::set<unsigned long> empty;
And, btw, when you create a new vector and give it an initial size N, if you don't provide the second argument, it will be default-constructed. So, you don't even need the empty
variable at all in this case, you would only need it if empty
wasn't empty (i.e., default-constructed).
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.