Search code examples
c++rhapsody

C++ move constructor with IBM Rhapsody


I am running IBM Rhapsody 8.1.5 here and moving a code base to modern C++.

I now face the issue that I can't define a move constructor, if a copy constructor is already defined, because Rhapsody simply ignores lvalue and rvalue references and thinks both constructors are the same.

Since I can't even choose the move constructor during creation, I tried to add && manually. Which also works, but Rhapsody won't let me save, because it thinks the Operation is a duplicate.

Does anybody have an idea how to achieve this in Rhapsody? Is this even possible, maybe at least with a more recent version? I would be happy to supply more information, if anything more helps.


Solution

  • This is IMHO a bug in the product. These workarounds exist in version 8.4:

    • First create a constructor of your class A with argument type int (or any other type different from A), then go to Features...Arguments and change the argument type to A and the code pattern to $type&&
    • Use C++ Declaration A&& instead of existing type for the argument