Steven Scott - 2004-04-20

I'm having a problem with access violations, I don't know if it's my inadequacy as a programmer or Microsoft's STL, but I cannot get a string from a const XmlRpcValue&.

void consttest( const XmlRpcValue &v ) {
  string x = v;
}
XmlRpcValue t = "huentaeu";
consttest( t );

No matter what I try, making x a const string, a reference, const reference, trying to cast v as a string, string&, const string, etc, I cannot get the value.  I can copy v to another XmlRpcValue and everything works fine, but I'd rather not add that extra step.  I always get an access violation during the assignment.  for instance, at one point I tried:

string x( ((string&)v).c_str(), ((string&)v).size() );

and traced it until it got to a memcpy().  It got the size correctly, allocated enough space in x's buffer, etc.  But the memcpy(), which should take a const void* as the source, gives me an access violation.

can anybody help me out?