i'm creating an custom string...I'm bulding it up from simpler to complex...I'm doing the cosntructos now, but I have got stucked doing the constructor which get a literal string....because I should have to move the string literal to the T* ptr.....here I leave my code...thanks!!
I have kind of found a solution, but it's not working..
1 2 3 4 5 6 7 8 9 10 11 12 13 14
String(const std::string&& str){ //here is the problem
size = str.length();
ptr = new C [size];
std::stringstream line(str);
C unit;
int cont = 0;
while(line>>unit){
ptr[cont] = unit;
cont++;
}
ptr[cont] = '\0';
}
but declaring line it apparently has an incomplete type...but the constructor os stringstream for c++11 allows to get a string literal ( a move in fact)....