Click here to Skip to main content
15,904,415 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Using CComPtr? (first time in ATL...) Pin
Paul M Watt13-Dec-02 5:20
mentorPaul M Watt13-Dec-02 5:20 
GeneralRe: Using CComPtr? (first time in ATL...) Pin
Joan M13-Dec-02 5:37
professionalJoan M13-Dec-02 5:37 
GeneralRe: Using CComPtr? (first time in ATL...) Pin
AlexO19-Dec-02 3:23
AlexO19-Dec-02 3:23 
GeneralRe: Using CComPtr? (first time in ATL...) Pin
Joan M19-Dec-02 3:44
professionalJoan M19-Dec-02 3:44 
Generallist of VARIANT Pin
bojinyu12-Dec-02 2:31
bojinyu12-Dec-02 2:31 
GeneralRe: list of VARIANT Pin
Daniel Strigl12-Dec-02 2:49
Daniel Strigl12-Dec-02 2:49 
GeneralRe: list of VARIANT Pin
bojinyu12-Dec-02 3:22
bojinyu12-Dec-02 3:22 
GeneralRe: list of VARIANT Pin
Daniel Strigl12-Dec-02 4:30
Daniel Strigl12-Dec-02 4:30 
Sorry, but I think I don't understand OMG | :OMG: Blush | :O !!!

I have tested your code:
// variant.cpp : Definiert den Einsprungpunkt für die Konsolenanwendung.
//

#include "stdafx.h"
#include <atlbase.h>
#include <list>

typedef std::list<VARIANT> VARIANTLIST;
VARIANTLIST varList;

int main(int argc, char* argv[])
{
    for (int n = 0; n < 100; n++)
    {
        VARIANT var;
        var.vt = VT_I2;
        var.iVal = 1;

        varList.push_back(var);
    }

    printf("size = %d \n", (int) varList.size());

    return 0;
}


There is all right with the code! I have a std::list of VARIANT and add 100 members of VARIANT to the list!

The varList.size() function returns the count of elements in the list and so it returns 100 and that's right!

The VT_I2 says that the VARIANT holds short members. I2 says that the member is an integer who need 2 byte of space in the memory (sizeof(short) = 2).

Take a look in the MSDN:

typedef struct tagVARIANT  {
   VARTYPE vt;
   unsigned short wReserved1;
   unsigned short wReserved2;
   unsigned short wReserved3;
   union {
      Byte                    bVal;                 // VT_UI1.
      Short                   iVal;                 // VT_I2. <===== LOOK HERE !!!
      long                    lVal;                 // VT_I4.
      float                   fltVal;               // VT_R4.
      double                  dblVal;               // VT_R8.

      ...
      ...
      ...
   };
};


Hope this helps you!


Daniel Wink | ;)
---------------------------
Never change a running system!
GeneralRe: list of VARIANT Pin
bojinyu12-Dec-02 18:07
bojinyu12-Dec-02 18:07 
GeneralRe: list of VARIANT Pin
bojinyu12-Dec-02 3:22
bojinyu12-Dec-02 3:22 
QuestionSTL Tree ? Pin
Nick Parker11-Dec-02 7:28
protectorNick Parker11-Dec-02 7:28 
AnswerRe: STL Tree ? Pin
Neville Franks11-Dec-02 9:25
Neville Franks11-Dec-02 9:25 
GeneralRe: STL Tree ? Pin
Nick Parker11-Dec-02 9:37
protectorNick Parker11-Dec-02 9:37 
GeneralRe: STL Tree ? Pin
Todd Smith12-Dec-02 11:36
Todd Smith12-Dec-02 11:36 
AnswerRe: STL Tree ? Pin
Paul M Watt13-Dec-02 5:26
mentorPaul M Watt13-Dec-02 5:26 
AnswerRe: STL Tree ? Pin
Jörgen Sigvardsson14-Dec-02 10:57
Jörgen Sigvardsson14-Dec-02 10:57 
QuestionHow do I raise events. Pin
acosmin11-Dec-02 3:15
acosmin11-Dec-02 3:15 
AnswerRe: How do I raise events. Pin
xi90412-Dec-02 2:07
xi90412-Dec-02 2:07 
GeneralSetSite Pin
suresh_sathya11-Dec-02 1:09
suresh_sathya11-Dec-02 1:09 
QuestionHow to use m_spClientSite Pin
hdi99kf@syd.kth.se6-Dec-02 2:42
hdi99kf@syd.kth.se6-Dec-02 2:42 
AnswerRe: How to use m_spClientSite Pin
geo_m6-Dec-02 5:25
geo_m6-Dec-02 5:25 
GeneralRe: How to use m_spClientSite Pin
Anonymous6-Dec-02 6:57
Anonymous6-Dec-02 6:57 
GeneralRe: How to use m_spClientSite Pin
geo_m6-Dec-02 8:39
geo_m6-Dec-02 8:39 
QuestionSTL Q : find_if = poop. any better? Pin
Chris Losinger5-Dec-02 15:50
professionalChris Losinger5-Dec-02 15:50 
AnswerRe: STL Q : find_if = poop. any better? Pin
Taka Muraoka5-Dec-02 16:07
Taka Muraoka5-Dec-02 16:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.