Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: medved on July 30, 2011, 03:44:04 am

Title: Generating static const arrays
Post by: medved on July 30, 2011, 03:44:04 am
Hi - I'm working in C++ and I'm running up against a problem with initializing a static const array as a class member.

The standard C++ to do so is as follows:
Code: [Select]
in ClassA.h:

Class A{
   private:
      static const string someStrings[4];
};

in ClassA.cpp:

const string A::someStrings[4] = {"A", "B", "C", "D"};

However, EA generates it this way:

Code: [Select]
in ClassA.h:

Class A{
   private:
      static const string someStrings[4] = {"A", "B", "C", "D"};
};

Which of course blows up.  I looked at the code template and I don't think it will ever put static consts in the Impl file, even though that is the correct way to do it in C++.  Anyone have a fix/thought for this?

M
Title: Re: Generating static const arrays
Post by: medved on August 03, 2011, 11:39:23 pm
As a heads up, EA has emailed me and said basically, yeah this is an issue.  We'll work on it.