|
From: Jerry v. D. <jv...@at...> - 2002-11-04 22:56:04
|
While trying out g++ 3.2, I did the following:
-----------------------------------------------------------------
#include <vector>
#include <string>
int main(int argc, char* argv[])
{
// std::vector<std::string> arguments(argv[0], argv[argc]);
std::vector<std::string> arguments;
for (int i=0; i<argc; i++)
arguments[i]=argv[i];
}
-----------------------------------------------------------------
which compiles Ok, but segfaults on execution. I did a lot of headscratching
but I cannot figure out why. arguments[i] evaluates to a string type, argv[i]
to effectively a const char*, and string has an const char* constructor.
Help would be apreciated.
--
-- Jerry van Dijk | email: jv...@at...
-- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk
|