Book a Demo

Author Topic: C++ code generation template - inline functions  (Read 4531 times)

yannv

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
C++ code generation template - inline functions
« on: October 25, 2011, 01:11:21 pm »
Hi,

I'm working with C++ code generation template.
I would like to generate my inline methods in the implementation file (.cpp) with the inline keywords and remove the inline keywords in the header file (.h).

Example:
MyClass.h
class MyClass {
    void myMethod();
};

MyClass.cpp
inline void MyClass::MyMethod()
{
}


Is there an option to do that or does anyone have the right template for this?

Other point, if you change your options for constructor/destructor generation in "Tools / Options / Source Code Engineering / Object Lifetimes", and then you generate your code (F11 on your class), the "Advanced" dialog box doesn't have your object lifetimes changes (and so your generated code).

Thanks for your help!

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: C++ code generation template - inline function
« Reply #1 on: October 25, 2011, 06:49:09 pm »
Hi,

I don't have any help for you regarding the code generation template, but if you place the 'inline' keyword inside the .cpp the compiler will ignore it, at least for calls from outside the .cpp. So what's the point??

WBR
Günther

yannv

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: C++ code generation template - inline function
« Reply #2 on: October 26, 2011, 12:28:41 pm »
My mistake Gunther. You're totally right, there is no point to implement inline methods outside the header file!!

What I really want to do is to put the definition of inline methods outside the class declaration. For example:
MyClass.h
class MyClass {
   void myMethod();
};

inline void MyClass::MyMethod()
{
}

Thanks!