Book a Demo

Author Topic: Generating static const arrays  (Read 2989 times)

medved

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Generating static const arrays
« 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

medved

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Generating static const arrays
« Reply #1 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.