tags:

views:

124

answers:

4

What does the 'operator' mean in this C++ usage?

char* pszVar= W2A(_bstr_t(bstrVar).operator wchar_t*());
+3  A: 

It marks an explicit call to the conversion operator to wchar_t*.

Péter Török
it is _not_ an operator, it is a construction for calling the conversion operator explicitly (as Klaim also answers).
haavee
@haavee, of course not. I clarified my wording.
Péter Török
+5  A: 

forcing the compiler to choose the, apparently defined, "convert to wchar_t*" operator in that class. "that class" being whatever is returned from the _bstr_t call.

haavee
+4  A: 

That's an explicit call to the convertion operator to wchar_t, to be sure it's this one that will be used and not another.

That said, that's ugly and certainly show a problem in the class members.

Klaim
A: 

It refers to the the casting operator.

Vulcan Eager