Home » U++ Library support » U++ Core » moveable with assert question
moveable with assert question [message #52369] |
Sun, 15 September 2019 17:30 |
|
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;
}
|
|
|
Goto Forum:
Current Time: Thu Mar 28 14:30:15 CET 2024
Total time taken to generate the page: 0.01047 seconds
|