I have been studying C++ for some time (not so long) and now I'm faced with a problem:
#ifndef _FILE_A_H
#define _FILE_A_H
template <typename T>
class A {
void func();
/// ... some code here
};
#include "a.cpp"
#endif
I want to place implementation of A-class in file 'a.cpp'
. But to do that I need to include 'a.h'
. Is it normal to cross-including files in that situation?
I have something like this in 'a.cpp'
(it's compiling but looks embarrasing):
#ifndef _FILE_A_CPP
#define _FILE_A_CPP
#include "a.h"
template <typename T>
void A<T>::func() {
/// ... some code here
}
/// ... and some code here
#endif