【发布时间】:2016-06-10 01:59:54
【问题描述】:
我有一个异常类定义如下:
class DeviceOpenException : public std::runtime_error {
public:
DeviceOpenException(const std::string& message)
: std::runtime_error("Device Open Exception: " + message) { };
};
我抛出异常如下:
throw DeviceOpenException(boost::str(boost::format("Cannot Open HID Device [Vendor ID = %1%] [Product ID = %2%] [Serial Number = %3%]") % vendorID %productID % serialNumber));
其中给former的参数如下:
(unsigned short vendorID, unsigned short productID, std::wstring serialNumber)
但是,这会导致以下编译错误:
error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const std::wstring' (or there is no acceptable conversion)
是我,还是 Boost 格式化程序不适用于 wstring 类型?
【问题讨论】: