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 » Community » Newbie corner » moveable question
moveable question [message #38005] Wed, 28 November 2012 04:56 Go to previous message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi-
In the following sample I thought this would break the moveable assertion. I used a class instead of a struct. I hooked up ultimate++ tonight and I wanted to see how moveable worked.


Please see my one in-line comment.

thanks for any assistance. - jim

#include <Core/Core.h>
#include<iostream>

using namespace Upp;
using namespace std;

class SimpleVector: Moveable<SimpleVector>{
UPP::Vector<int*> v;
int * val;
int a;
SimpleVector * sv;

public:
SimpleVector();

SimpleVector& operator=( const SimpleVector& rhs );

~SimpleVector();

void TestMove();
};

SimpleVector::SimpleVector(){
int n = 2;
int * y = &n;


v.Add(y);
cout<<*v[0];
}

SimpleVector::~SimpleVector(){

AssertMoveable<SimpleVector>();

}

void SimpleVector::TestMove(){

val = &a;
sv = this;
// thought these 2 would break moveable assertion per the example in docs ??

}
SimpleVector& SimpleVector::operator=( const SimpleVector& rhs ){

sv= rhs.sv;
return *this;
}
CONSOLE_APP_MAIN
{


SimpleVector s;
s.TestMove();



}

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: How do you create this?
Next Topic: hiding the vertical scrollbar of LineEdit Ctrl
Goto Forum:
  


Current Time: Thu Apr 25 23:19:28 CEST 2024

Total time taken to generate the page: 0.02810 seconds