Topic: Help with STL


Author: thomash@smartlink.net (thomas)
Date: 1996/06/27
Raw View
I'm trying to create a Tree Control like the std one that comes with MSVC. I'm
having a little problem with the STL. When I compile the code fragment below I
get an error that says it can't find the constructor. What I'm trying to do is
create a single class that create children of it self for the branches.

Does any one have any good ideas how to fix this? Or is this a legal thing do?

// =======================================================================
class TNode{

private:
 std::vector<TNode>  kids;
 CString   title;
 int    iconid;
 int    id;

public:
 TNode(){}
 TNode( CString _title, int _id, int _iconid) :  title( _title),

id(  _id),

iconid( _iconid){}
 ~TNode(){}

};

// =======================================================================

// what the output needs to look like?

/*
   node
     kid
  |  kid
  |  | kid
  | | kid
  | | | kid
  | | | kid
  | | kid
  | kid
  |  kid
  |    kid
     kid
  |  kid
     kid
     kid
  |  kid
  |  kid
  |  | kid
  | kid
  | | kid
  | |  kid
  | kid
  |    kid

*/



[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]