a question declaring a STL container holding iterators

Discussion in 'C++' started by moggous phar, Oct 15, 2004.

  1. moggous phar

    moggous phar Guest

    how i have to declarate stuff like this:

    typedef struct { PfadIter Parent; CString Name; } PFADSTRUCT;

    typedef PfadMapType::iterator PfadIter;
    typedef std::map<PFADSTRUCT, int> PfadMapType;


    is there any uncomplete decl like

    struct A;
    struct B {struct A *pa};
    struct A {struct A *pa};


    I'm using MS VC++ 6

    Thanks,
    Moggous
    moggous phar, Oct 15, 2004
    #1
    1. Advertising

  2. moggous phar wrote:
    > how i have to declarate stuff like this:
    >
    > typedef struct { PfadIter Parent; CString Name; } PFADSTRUCT;
    >
    > typedef PfadMapType::iterator PfadIter;
    > typedef std::map<PFADSTRUCT, int> PfadMapType;


    you don't need to use typedef's when declaring a struct - it really is
    not somthing you want to do.

    struct PFADSTRUCT { PfadIter Parent; CString Name; };
    typedef PfadMapType::iterator PfadIter;
    typedef std::map<PFADSTRUCT, int> PfadMapType;

    Well, this is not somthing you can do with the STL.

    One alternative is:

    struct PFADSTRUCT;
    typedef PfadMapType::iterator PfadIter;
    typedef std::map<PFADSTRUCT *, int> PfadMapType;
    struct PFADSTRUCT { PfadIter Parent; CString Name; };

    I use reference counted objects in this case:

    struct PFADSTRUCT;
    typedef PfadMapType::iterator PfadIter;
    typedef std::map<Ptr<PFADSTRUCT *>, int> PfadMapType;
    struct PFADSTRUCT : PtrTarget { PfadIter Parent; CString Name; };

    >
    >
    > is there any uncomplete decl like
    >
    > struct A;
    > struct B {struct A *pa};
    > struct A {struct A *pa};
    >
    >
    > I'm using MS VC++ 6


    Use somthing better. VS 7.1 is much much better.
    Gianni Mariani, Oct 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maitre Bart
    Replies:
    2
    Views:
    510
    Maitre Bart
    Feb 11, 2004
  2. Patrick Kowalzick

    Iterators over nested STL container

    Patrick Kowalzick, Aug 3, 2005, in forum: C++
    Replies:
    2
    Views:
    371
    Chris Theis
    Aug 3, 2005
  3. Replies:
    4
    Views:
    780
    Daniel T.
    Feb 16, 2006
  4. wolverine
    Replies:
    2
    Views:
    437
    Marcus Kwok
    Jul 24, 2006
  5. desktop

    Declaring iterators

    desktop, Apr 28, 2007, in forum: C++
    Replies:
    7
    Views:
    371
    James Kanze
    Apr 29, 2007
Loading...

Share This Page