[C++] typedef Problem

Von: , Frage gestellt am Mo, 28. Mai 2001

Hallo,

was bedeutet im folgenden CodeSchnipsel die letzte Zeile:


struct ListNumber       
{
CString             s;
BOOL                b1;
BOOL                b2;
};
typedef CArray< ListNumber , ListNumber &> ListNumberArray;


danke Ralf

2 Antworten zu dieser Frage

  1. Antwort von nach 2 Stunden 0 hilfreich
    VC-Hilfe

    Hi Ralf :)

    Hier ist das, was MSDN dazu meint ...

    The simple array and list classes,CArray andCList, take two parameters: TYPE and ARG_TYPE. These classes can store any data type, which you specify in the TYPE parameter:

    Fundamental C++ data types, such as int, char, and float
    C++ structures and classes
    Other types that you define

    For convenience and efficiency, you can use the ARG_TYPE parameter to specify the type of function arguments. Typically, you specify ARG_TYPE as a reference to the type you named in the TYPE parameter. For example:

    CArray<int, int> myArray;
    CList<CPerson, CPerson&> myList;

    The first example declares an array collection, myArray, that contains ints. The second example declares a list collection, myList, that stores CPerson objects. Certain member functions of the collection classes take arguments whose type is specified by the ARG_TYPE template parameter. For example, the Add member function of class CArray takes an ARG_TYPE argument:

    CArray<CPerson, CPerson&> myArray;
    CPerson person;
    myArray->Add( person );

    Viele Grüße

    Stefan.

    • Antwort von nach 4 Stunden 0 hilfreich
      Re: VC-Hilfe

      Hi Stefan, besten Dank, viele Grüße Ralf

Keine passende Antwort gefunden? Jetzt eigene Frage stellen!