passing a string literal to a function that takes a std::string&

Viewed 13798

I have the following function

void AddNodeValue(XMLNode& node, std::string& value);

I want to use it like this:

document.AddNodeValue(modvalue,"modvalue");

and the compiler complains:

error C2664: 'void XML::XMLDocument::AddNodeValue(XML::XMLNode &,std::string &)' : cannot convert parameter 2 from 'const char [9]' to 'std::string &'
        A reference that is not to 'const' cannot be bound to a non-lvalue

I don't get why that is wrong?

Compiler: VS2003

1 Answers
Related