So I've been working with Precompiled headers for awhile now.
I only include headers that won't change, like mostly standard libraries (iostream, string, vector etc…).
But sometimes, I only need a struct to hold such data (string, vector and so on) and I would
have a class that uses the struct. Of course, it's also used by other classes, so I cannot
exclude it somehow.
An example would be this:
// Data.h
struct Data
{
std::string mName;
std::string mOtherName;
std::vector<int> mNumbers;
}
// Later in Foo.cpp
void Foo::DoSomething()
{
Data someData;
...Play with someData...
}
// And of course in Boo.cpp
void Boo::DoSomething()
{
Data someData;
...Play with someData...
}
Simply speaking, I'm in a situation where I cannot really put the Data struct into somewhere more excluded,
so I wanted to ask, is it smelly that Data has an Empty cpp file just to take advantage of Precompiled headers?