Consider this code
typedef boost::variant<int, std::string> var_t;
// this interface class will be implemented in DLL
class producer
{
public:
virtual var_t produce() = 0;
};
// this class will be implemented by DLL user and
// pointer to object of this class will be passed to producer
// as callback interface
class produce_handler
{
public:
virtual void handle_produce(const var_t&) = 0;
};
It is known that it is generally unsafe to pass STD objects through dynamic library boundary. What about boost types, especially variant?