array of const for other compilers |
Top Previous Next |
What is translated > Types > Arrays > Array parameters > array of const > array of const for other compilers
array of const is reproduced for other compilers by an ArrayOfConst class defined in d2c_sysvariant.h, ArrayOfConst is derived from std::vector<TVarRec>.
class ArrayOfConst : public std::vector<TVarRec>
A function declaration with such a parameter looks like:
procedure foo(Args : array of const);
->
void foo ( const ArrayofConst& Args );
The call of the function therefore converts as:
foo(['hello', 'world']); -> foo ( ArrayofConst&( "hello", "world" ) );
Since the ArrayOfConst class has the size method in contrast to C++Builder an additional parameter isn't necessary.
TVarRec
For C++ versions before C++17 TVarRec is defined as a union of different C++ types and a VType field, which indicates which of that types the actual value has.For C++ 17 TVarRec ist defined as a std::variant. In both versions the number of different types that can be stored in TVarRec is less than the number in Delphi, because in C++ there is no difference between WideString and UnicodeString. Therefore there are double cases in case-/switch-statement.
|
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |