Home » U++ Library support » U++ Core » moveable with assert question
Re: moveable with assert question [message #52374 is a reply to message #52373] |
Sun, 15 September 2019 21:26 |
|
Hi all-
It is still not working. I will list the last attempt here. Not sure what I am doing wrong!
class Foo:Moveable<Foo> {
char * buffer;
public:
Foo(){
buffer = NULL;
}
Foo(const char * c) {
if( c!=NULL)
{
buffer= new char [strlen(c) + 1];
strcpy(buffer, c);
} else
buffer = NULL;
}
Foo(Foo&& foosrc) {
if(foosrc.buffer !=NULL) {
buffer=foosrc.buffer;
foosrc.buffer = NULL;
}
}
CONSOLE_APP_MAIN
{
Foo f("foo");
Foo && r2 = std::move(f) ;
Vector<Foo> v1;
v1.Add(r2);
}
If I am making a glaring error that you can see please help me with the trick!
thanks roboloki
|
|
|
Goto Forum:
Current Time: Tue May 14 23:28:20 CEST 2024
Total time taken to generate the page: 0.02718 seconds
|