Suppose I want to create the the Following class:
#pragma once
#include <memory>
#include <string>
namespace stackquestion
{
struct Logger
{
void Log(std::string message);
private:
class Impl;
std::unique_ptr<Impl> impl;
};
}
When I want to publish the class I end up depending on my consumers definition of std::string
and std::unique_ptr
. I am vague on the meaning of publish. I am thinking of handing someone a library either for static or dynamic linking.
When I fall back to a version without those includes I end up losing the comfort / safety that I wanted to gain.
#pragma once
namespace stackquestion
{
struct Logger
{
void Log(const char *);
private:
class Impl * impl;
};
}
Is there a silver bullet that I am missing?