0
考慮以下代碼將boost :: variant傳遞給(from)dll是否安全?
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;
};
已知其通常爲不安全的通STD通過動態庫邊界的對象。增強類型,特別是變體呢?
同樣的問題與提升與標準。總是依賴於編譯器/編譯器版本/升級版本。 – user1810087
另外,在'variant'中有一個'std :: string':你覺得'variant'是多麼神奇? – Yakk