Feb 11, 2013 at 8:11pm UTC
I want to clear a Multidimensional vector but "clear()" function isn't working.Can anybody help me?
Feb 11, 2013 at 8:23pm UTC
If you clear the outer vector, all inner vectors are destroyed - is this not what you want? In what way is the clear function not working?
Feb 11, 2013 at 8:32pm UTC
there's a flaw in Dev C++ compiler. So, it doesn't work on it
Feb 11, 2013 at 8:34pm UTC
Then don't use the old, outdated Bloodshed Dev-C++ compiler.
Feb 11, 2013 at 8:39pm UTC
Old is gold. Dev C++ is good in many ways irrespective of its flaws.
Feb 11, 2013 at 8:44pm UTC
Dev-C++ has been updated since the old Bloodshed version that didn't even comply with the standard.
Feb 11, 2013 at 8:46pm UTC
Yes. But still they weren't able to fix the problem.
Feb 11, 2013 at 8:48pm UTC
Then don't use Dev-C++ if you want a working compiler? I don't understand where the confusion is here.
Feb 11, 2013 at 8:54pm UTC
Thats the only solution hoity :(
Feb 11, 2013 at 8:55pm UTC
Did you just assume the OPer is using Dev-C++? Or did he mention it elsewhere? It just seems like a random assumption.
Feb 11, 2013 at 8:58pm UTC
I use Dev C++ and clear() wont work on it. and its obviously a random assumption.
Feb 11, 2013 at 9:01pm UTC
What do you mean by "clear() wont work on it"? Can you post the code you tested with? It might not be a bug with Dev-C++
Feb 12, 2013 at 9:38am UTC
What's wrong with my code
Feb 12, 2013 at 11:14am UTC
graph isn't a "multidimensional vector". It's an array of vectors. In other words, graph is simply a pointer to a vector. You can't call clear on it, because it's not an object with a clear method, or any methods at all.
Edit: JLBorges post shows you how to make it a multidimensional vector - i.e. a vector of vectors.
Last edited on
Feb 12, 2013 at 11:16am UTC