list<CComBSTR> error.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ishekar

    #1

    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_bac k(CComBSTR(L"te st"));

    e:\program files\microsoft visual studio\vc98\inc lude\list(222) : error
    C2664: 'construct' : cannot convert parameter 1 from 'unsigned short ** ' to
    'class ATL::CComBSTR *'
    Types pointed to are unrelated; conversion requires
    reinterpret_cas t, C-style cast or function-style cast
    e:\program files\microsoft visual studio\vc98\inc lude\list(218) :
    while compiling class-template member function 'class std::list<class
    ATL::CComBSTR,c lass std::allocator< class ATL::CComBSTR> >::iterator
    __thiscall std::list<class ATL::CComB
    STR,class std::allocator< class ATL::CComBSTR> >::insert(cla ss
    std::list<class ATL::CComBSTR,c lass std::allocator< class ATL::CComBSTR>[color=blue]
    >::iterator,con st class ATL::CComBSTR &)'[/color]
    Error executing cl.exe.

    The above error is found in the line
    allocator.const ruct(&_Acc::_Va lue(_S), _X);

    TFH
    ISR


  • John Harrison

    #2
    Re: list&lt;CComBST R&gt; error.


    "ishekar" <ishekara@vsnl. net> wrote in message
    news:bgtllp$349 $1@news.mch.sbs .de...[color=blue]
    > 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_bac k(CComBSTR(L"te st"));
    >[/color]

    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


    Comment

    • ishekar

      #3
      Re: list&lt;CComBST R&gt; error.

      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" <john_andronicu s@hotmail.com> wrote in message
      news:bgtmea$rk2 f8$1@ID-196037.news.uni-berlin.de...[color=blue]
      >
      > "ishekar" <ishekara@vsnl. net> wrote in message
      > news:bgtllp$349 $1@news.mch.sbs .de...[color=green]
      > > 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_bac k(CComBSTR(L"te st"));
      > >[/color]
      >
      > 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++[/color]
      6.[color=blue]
      > Check in an ATL/COM group.
      >
      > john
      >
      >[/color]


      Comment

      Working...