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
moveable with assert question [message #52369] Sun, 15 September 2019 17:30 Go to previous message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi all-

I thought this code below would kick out an error when compiled that it is a moveable violation.

Can you please give me a tip on how to check for moveable with the code below?

thnx. roboloki

#include <Core/Core.h>

using namespace Upp;

class Foo: Moveable<Foo> {
    int a;
    Foo *foo;
    int *ptr;
public:
    void Set(Foo * f) {
        foo = f;
    }
  
void Bad1() {
        foo = this;
    // member variable foo exists outside method
    // -> makes Foo non-moveable
    }       
    ~Foo() {
     
    }
};

template <typename T> class Metallica
{
   T * t;
   public:
   
   Metallica (){};
   
   void Set(T * t1) {
        t = t1;
    
    
   }
   
    ~Metallica() {
    AssertMoveable<T>();  
    }
};

CONSOLE_APP_MAIN
{
	
	Metallica<Foo> lu;
	
}
 
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: Thu Mar 28 14:30:15 CET 2024

Total time taken to generate the page: 0.01047 seconds