C++ Code Generation and variable multiplicity [message #1803898] |
Wed, 13 March 2019 07:02  |
Eclipse User |
|
|
|
Hello everyone,
I'm trying to use variables with a multiplicity which is undefined (more than 1) and generate C++ code.
If the multiplicity field is set to 0..* , the code generator set an array. It's fine if the multiplicity is known and defined (for instance 3), but if 0..* is set, the code cannot compile.
As in C++, tables have fixed size, I propose that in the case where the multiplicity is set to *, the property would be generated as std::vector.
For example, if I defined a property like this in the model :
MyType prop[0..*]
The code result could be:
std::vector<MyType> prop;
Currently, the generated code cannot be compiled :
MyType prop[];
I know that I can create an external type which uses std::vector to type the property but I think this is a lack for the multiplicity management of a variable. Could you give your opinion and maybe other ideas ?
Regards.
Yoann.
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06226 seconds