|
|
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  |
 |
Xemuth
Messages: 387 Registered: August 2018 Location: France
|
Senior 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   |
omari
Messages: 276 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.
|
|
|
|
|
|
Goto Forum:
Current Time: Sun May 11 14:44:04 CEST 2025
Total time taken to generate the page: 0.04471 seconds
|
|
|