mardi 8 juin 2021

invalid initialization of non-const reference of type for reference parameter [closed]

In getVehicleResults trying to call StringUtil namespace to access createTrimmedString function passing string reference parameter, vinLine that createTrimmedString will modify.

I am getting error:

invalid initialization of non-const reference of type ‘std::string&
   {aka std::basic_string<char>&}’ from an rvalue of type
   ‘std::basic_string<char>
//StringUtil.h
#include <string>
using namespace std;
#include <list>
#include <locale>

typedef list<string > stringList;

namespace StringUtil{ static void createTrimmedString(string& vinLine);
string ulongToString(double value, bool active);
} 

Aucun commentaire:

Enregistrer un commentaire