By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,415 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

list<CComBSTR> error.

P: n/a
Hi all,

Dont hit me for asking this in this forum but i feel this question is
related to allocators hence i think its the right place.
I was trying to use the list of CComBSTR but was getting this error. can
anyone tell me why, is there a workaround

list<CComBSTR> lstStr;
lstStr.push_back(CComBSTR(L"test"));

e:\program files\microsoft visual studio\vc98\include\list(222) : error
C2664: 'construct' : cannot convert parameter 1 from 'unsigned short ** ' to
'class ATL::CComBSTR *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
e:\program files\microsoft visual studio\vc98\include\list(218) :
while compiling class-template member function 'class std::list<class
ATL::CComBSTR,class std::allocator<class ATL::CComBSTR> >::iterator
__thiscall std::list<class ATL::CComB
STR,class std::allocator<class ATL::CComBSTR> >::insert(class
std::list<class ATL::CComBSTR,class std::allocator<class ATL::CComBSTR>
::iterator,const class ATL::CComBSTR &)'

Error executing cl.exe.

The above error is found in the line
allocator.construct(&_Acc::_Value(_S), _X);

TFH
ISR
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"ishekar" <is******@vsnl.net> wrote in message
news:bg**********@news.mch.sbs.de...
Hi all,

Dont hit me for asking this in this forum but i feel this question is
related to allocators hence i think its the right place.
I was trying to use the list of CComBSTR but was getting this error. can
anyone tell me why, is there a workaround

list<CComBSTR> lstStr;
lstStr.push_back(CComBSTR(L"test"));


CComBSTR is not suitable for the STL because it stupidly overloads the &
operator.

In ATL 3 there is a wrapper class that makes CComBSTR STL compatible. I
forget what its called, or whether it is even available to you using VC++ 6.
Check in an ATL/COM group.

john
Jul 19 '05 #2

P: n/a
I got the answer. CComBSTR does not support the & operator hence the ATL
class CAdapt which does this can be used.
typedef list< CAdapt<CComBSTR> > lstString;

Thanks
ISR

"John Harrison" <jo*************@hotmail.com> wrote in message
news:bg************@ID-196037.news.uni-berlin.de...

"ishekar" <is******@vsnl.net> wrote in message
news:bg**********@news.mch.sbs.de...
Hi all,

Dont hit me for asking this in this forum but i feel this question is
related to allocators hence i think its the right place.
I was trying to use the list of CComBSTR but was getting this error. can
anyone tell me why, is there a workaround

list<CComBSTR> lstStr;
lstStr.push_back(CComBSTR(L"test"));

CComBSTR is not suitable for the STL because it stupidly overloads the &
operator.

In ATL 3 there is a wrapper class that makes CComBSTR STL compatible. I
forget what its called, or whether it is even available to you using VC++

6. Check in an ATL/COM group.

john

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.