I have the following problem. There is a function:
int main()
{
//...
std::string test = "1234";
std::string result = ValueToCharArray(test);
//...
}
template<class Type>
std::string ValueToCharArray(Type& value)
{
std::string buffer = "";
//...
if (typeid(std::string) == typeid(value))
{
std::cout << typeid(std::string).name() << '\n' << typeid(value).name() << '\n';
value.at(0);
//...
}
short int i = 0;
while (i<3)
{
buffer += '?';
i++;
}
buffer[i] = 0;
return buffer;
}
if i transfer string compiller give me next problem: screen
error C2039: at: not member "std::basic_istream<char,std::char_traits>" typetostring.h (sorry for the language )
if i delete link from value variable "ValueToCharArray(Type value)" i get next error:
error C2280: "std::basic_ostream<char,std::char_traits>::basic_ostream(const std::basic_ostream<char,std::char_traits> &)": you can't get link in removed function
I need to process it when a string type hits the function. VS say me this type it's std::ostream but this function link...
CAUTION!can using c++11 or c++14.The function is overloaded. It is not advisable to change the fx call. You cannot create a separate function for the string type. I will be grateful to everyone who will help at least a little. Sorry for the language :D
Aucun commentaire:
Enregistrer un commentaire