Thomson
Thomson

Reputation: 21615

Advantage of std::wstring over CComBSTR

There are some questions talked about conversion between std::wstring and CComBSTR, like this one, but what' the advantage of each one over the other if both are available in a project?

Upvotes: 1

Views: 140

Answers (1)

user1610015
user1610015

Reputation: 6668

std::wstring has more methods for actual string handling, whereas CComBSTR is meant specifically for holding a BSTR string. BSTRs are used mostly by COM methods and have a different memory layout. Generally you should use std::wstring or CString unless you actually need the memory layout of BSTRs.

Upvotes: 3

Related Questions