1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 14:08:35 +08:00

cmVSSetupHelper: Remove unused SmartBSTR copy operations

For our use case we do not actually need to copy these.
Mark the operations as `= delete` to simplify the code.
This commit is contained in:
Brad King
2019-08-22 11:21:04 -04:00
parent 3f4c4e7afe
commit b1cfaf7b91

View File

@@ -74,28 +74,8 @@ class SmartBSTR
{
public:
SmartBSTR() { str = NULL; }
SmartBSTR(const SmartBSTR& src)
{
if (src.str != NULL) {
str =
::SysAllocStringByteLen((char*)src.str, ::SysStringByteLen(src.str));
} else {
str = ::SysAllocStringByteLen(NULL, 0);
}
}
SmartBSTR& operator=(const SmartBSTR& src)
{
if (str != src.str) {
::SysFreeString(str);
if (src.str != NULL) {
str =
::SysAllocStringByteLen((char*)src.str, ::SysStringByteLen(src.str));
} else {
str = ::SysAllocStringByteLen(NULL, 0);
}
}
return *this;
}
SmartBSTR(const SmartBSTR& src) = delete;
SmartBSTR& operator=(const SmartBSTR& src) = delete;
operator BSTR() const { return str; }
BSTR* operator&() throw() { return &str; }
~SmartBSTR() throw() { ::SysFreeString(str); }