I am converting the Delphi expression seen below to C++Builder. My C++Builder code generates the error message E2299. I put the full text for this error description below. Can you recommend a change to my C++ code to get this working.
//Delphi
TYPE
Regions = (North,South,East,West);
RegionSet = SET OF Regions;
//C++Builder
enum Regions { North, South, East, West };
typedef Set<Regions, North, West> RegionSet;
E2299 Cannot generate template specialization from 'Set'
You need to add a property to your program.
The declaration of a property specifies a name and a type, and includes at least one access specifier. The syntax of a property declaration is:
property propertyName[indexes]: type index integerConstant specifiers;
where:
propertyName is any valid identifier
[indexes] is optional and is a sequence of parameter declarations separated by semicolons
Each parameter declaration has the form identifier1, ..., identifiern: type
type must be a predefined or previously declared type identifier. That is, property declarations like property Num: 0..9 ... are invalid.
the index integerConstant clause is optional.
specifiers is a sequence of read, write, stored, default (or nodefault), and implements specifiers.
Every property declaration must have at least one read or write specifier.
edit below:
The problem was the typedef seen below would not compile inside a C++Builder function. I had the typedef setup in the CheckRegion function.
void __fastcall TForm1::CheckRegion( bool visible ){
//C++Builder
enum Regions { North, South, East, West };
typedef Set<Regions, North, West> RegionSet;
}
The solution was to move the typedef to the top of the main form just below TForm1 *Form1; like seen below.
//--------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
// use "typedef" here
enum RegionsCpp {NorthCpp, SouthCpp, EastCpp, WestCpp };
typedef Set<RegionsCpp, NorthCpp, WestCpp> RegionSetCpp;
//--------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
void __fastcall TForm1::CheckRegion( bool visible ){ //C++Builder enum Regions { North, South, East, West }; typedef Set<Regions, North, West> RegionSet; RegionSet reg; reg = RegionSet(); if(visible==true){ //work here }else{ //work here } }- homebasetypedef set<Regions, North, West> RegionSet;This generates a different error. E2257 , expected. The compiler gives the error on this typedef line and highlights the two brackets < >. Does that help? - homebase