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 » I don't understand Moveable (probleme on moveable (operateur*))
I don't understand Moveable [message #50338] Thu, 27 September 2018 14:10 Go to next message
Xemuth is currently offline  Xemuth
Messages: 22
Registered: August 2018
Location: France
Promising Member
Hello Everyone,

I have a class that contains only two string :

class Argument{
     public:
Argument(Upp::String argname, Upp::String argvalue);
	   	Argument();
		Upp::String ArgName; 
		Upp::String ArgValue;
};


Somewhere in my code I want to do some Vector of "Argument" :
	Upp::Vector<Argument> mesArguments;
	mesArguments.Insert(mesArguments.GetCount() ,Argument("test1","test1"));
	mesArguments.Insert(mesArguments.GetCount(),Argument("test2","test2"));
	mesArguments.Insert(mesArguments.GetCount(),Argument("test3","test3"));

and later in my code I past this vector through a Method that copy the vector into another vector :
void RequetageSoap::SetLesArgs(const Upp::Vector<Argument> &lesargs){
  	for(Argument arg : lesargs){
		this->lesArgs.Insert(this->lesArgs.GetCount(),arg);	// Here lesArgs is my Secondary vector of Argument
	}
}

When I compile it I got this kind of error : C:\Upp\upp/uppsrc/Core/Topt.h (157): error: no match for 'operator*' (operand type is 'Argument')

According to : https://www.ultimatepp.org/srcdoc$Core$Moveable$en-us.html
it happen because Argument is not marked as moveable

so I juste try to inherite my class Argument with : Moveable<Argument> but I got a lot of errors at compilation :
class Argument : Moveable<Argument>{
	    public:
	    Argument(Upp::String argname, Upp::String argvalue);
	    Argument();
		Upp::String ArgName;
		Upp::String ArgValue;
};


C:\Upp\upp\MyApps\TestCallSoap\RequetageSoap.h (10): error: expected template-name before '<' token
C:\Upp\upp\MyApps\TestCallSoap\testCallSoap.cpp (2): In file included from C:\Upp\upp\MyApps\TestCallSoap\testCallSoap.cpp:2:0:
(): class Argument : Moveable<Argument>{
C:\Upp\upp\MyApps\TestCallSoap\RequetageSoap.h (10): error: expected '{' before '<' token
C:\Upp\upp\MyApps\TestCallSoap\RequetageSoap.h (10): error: expected unqualified-id before '<' token
C:\Upp\upp\MyApps\TestCallSoap\testCallSoap.cpp (40): error: invalid use of incomplete type 'class Argument'
C:\Upp\upp\MyApps\TestCallSoap\testCallSoap.cpp (41): error: invalid use of incomplete type 'class Argument'
...
can Someone explain me why ?

(sorry for my bad english)

Thanks in advance
Re: I don't understand Moveable [message #50344 is a reply to message #50338] Fri, 28 September 2018 11:28 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 183
Registered: March 2010
Experienced Member
Hi,

Moveable is a part of the Upp namespace,

you have to use Upp::Moveable

or add "using namespace Upp" at the beginning of your cpp file (after includes)


regards
omari.
Re: I don't understand Moveable [message #50345 is a reply to message #50338] Fri, 28 September 2018 13:30 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 22
Registered: August 2018
Location: France
Promising Member
Thanks Omari,

However I had the Upp namespace, sadly I didnt find any issue to fix the problème,
so I just change my Upp::Vector<Argument> to Upp::Vector<Argument*>

Howerver if someone have any idea of why my inherite didn't worked, it would be really
interesting if he could explain it Razz

Thanks in advance !
Re: I don't understand Moveable [message #50346 is a reply to message #50345] Fri, 28 September 2018 14:01 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 596
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello Xemuth,

Please try to change inheritance level to public:
class Argument : public Upp::Moveable<Argument>{


Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
Re: I don't understand Moveable [message #50347 is a reply to message #50338] Fri, 28 September 2018 15:16 Go to previous message
Xemuth is currently offline  Xemuth
Messages: 22
Registered: August 2018
Location: France
Promising Member
Hello Klugier

since I remember to have tried it
I just rewrite my class :
class Argument : public Upp::Moveable<Argument>{
	    public:
	    Argument(Upp::String argname, Upp::String argvalue);
	    Argument();
	    Upp::String ArgName;
	    Upp::String ArgValue;
};

And it worked Embarassed
I think I forget to do public inherite when I tried to use Namespace on Moveable
and vice versa. Embarassed

Well it work now (I feel stupid).
Thank you everyone for taking the time to answer me. Very Happy

Have a good day !
Previous Topic: Adding a socket to a GUI application
Next Topic: RLOG in Linux
Goto Forum:
  


Current Time: Sat Feb 23 20:50:55 CET 2019

Total time taken to generate the page: 0.00674 seconds