Original Post
Hey Guys,
The following works for me in Windows.
I have one header file for declaration "TemplateChk.h"
I have one header file for definition "TemplateChkDef.h"
And in your target application you could define concrete classes for the corresponding template classes in Concrete.cpp
So your header file for template classes need not contain implementation, thereby improving compilation time for template
classes, if I am not mistaken.
Just want to know if what I am doing is correct and is it supported on other Platforms like Linux and Apple IOS ?
Thanks
-------------------------------------------------
//TemplateChk.h
-------------------------------------------------
#pragma once
template
class TemplateChk
{
E val;
public:
void lama();
};
-------------------------------------------------
TemplateChkDef.h
-------------------------------------------------
#pragma once
template
class TemplateChk
{
E val;
public:
void lama()
{
}
};
-------------------------------------------------
Concrete.cpp
-------------------------------------------------
#include "TemplateChkDef.h"
template TemplateChk;
template TemplateChk;
.....
//Compilation time for this file is reduced since it does not include template class with function definition
-------------------------------------------------
Application.cpp
-------------------------------------------------
#include "TemplateChk.h"
void main()
{
TemplateChk mamma;
mamma.lama();
TemplateChk mamma;
mamma.lama();
}
The following works for me in Windows.
I have one header file for declaration "TemplateChk.h"
I have one header file for definition "TemplateChkDef.h"
And in your target application you could define concrete classes for the corresponding template classes in Concrete.cpp
So your header file for template classes need not contain implementation, thereby improving compilation time for template
classes, if I am not mistaken.
Just want to know if what I am doing is correct and is it supported on other Platforms like Linux and Apple IOS ?
Thanks
-------------------------------------------------
//TemplateChk.h
-------------------------------------------------
#pragma once
template
class TemplateChk
{
E val;
public:
void lama();
};
-------------------------------------------------
TemplateChkDef.h
-------------------------------------------------
#pragma once
template
class TemplateChk
{
E val;
public:
void lama()
{
}
};
-------------------------------------------------
Concrete.cpp
-------------------------------------------------
#include "TemplateChkDef.h"
template TemplateChk
template TemplateChk
.....
//Compilation time for this file is reduced since it does not include template class with function definition
-------------------------------------------------
Application.cpp
-------------------------------------------------
#include "TemplateChk.h"
void main()
{
TemplateChk
mamma.lama();
TemplateChk
mamma.lama();
}