Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SetVppLogNoDeleteOnStartup() declaration is missing
Next Topic: FileSize
Goto Forum:
  


Current Time: Tue May 14 23:28:20 CEST 2024

Total time taken to generate the page: 0.02718 seconds