Function takes a ref to a string but not a string literal from the call

Hello there folks!

I have a problem with some code. My function would be like:

1
2
3
void function(const std::string& string1){
//do something here
}


The thing is that I cannot call the function like

 
function("SomeTextHere");


but If I declare a string above that line and use that in the function it just works. Is this because of the declaration of the literal as a char*?

Thank you for any replies!
I don't see why this wouldn't work. What error message do you get?
Just tested your code. It works. If you are having trouble, it is probably not from that function.
Topic archived. No new replies allowed.