Перегрузка операций
remote_addr=http_xforwarded_for+","+remote_addr;
но работает:
http_xforwarded_for=http_xforwarded_for+",";
remote_addr=http_xforwarded_for+remote_addr;
объявление выглядит так:
/* Operator char*+mString */
friend mString operator+ (char* str1, mString& str2) {
long new_length=strlen(str1)+str2.length;
unsigned char *new_c_str=(unsigned char*)malloc(new_length+2);
strcpy((char*)new_c_str,str1);
strcat((char*)new_c_str,(char*)str2.c_str);
mString result((char*)new_c_str);
return(result);
}
/* Operator mString+char* */
friend mString operator+ (mString& str2,char* str1) {
long new_length=strlen(str1)+str2.length;
unsigned char *new_c_str=(unsigned char*)malloc(new_length+2);
strcpy((char*)new_c_str,(char*)str2.c_str);
strcat((char*)new_c_str,str1);
mString result((char*)new_c_str);
return(result);
}
/* Operator mString+mString */
friend mString operator+ (mString& str1, mString& str2) {
long new_length=str1.length+str2.length;
unsigned char *new_c_str=(unsigned char*)malloc(new_length+2);
strcpy((char*)new_c_str,(char*)str1.c_str);
strcat((char*)new_c_str,(char*)str2.c_str);
mString result((char*)new_c_str);
return(result);
}