473,383 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

list<CComBSTR> error.

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
2 3866

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: robert | last post by:
Hi All, I have a problem. I have written a COM DLL in VB6 to do some stuff. I need to call this DLL from a VC++ program for which I have the code. I have managed to get as far as creating the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.