c++ - Structure initialization -
i have used following structure
template <typename item> struct tset {     typedef std::set <int, comparator <item>  >  type; };   as data member of the structure
template <typename item> struct tobject {     int code;     ...    typename tset <item> ::type indices;     tobject ( const list <item> *list ) : code( 0 ), indices ( list ) {}  };   where
 template <typename item>  struct tlist  {     typedef std::vector <item> type;  };  template <typename item> class list {     private:             typename tlist <item>::type items; };   but have changed data model to
template <typename item>  class tset : public std::set <int, comparator <item>  > { };  template <typename item> struct tobject {    int code;    ...   typename tset <item> indices;    tobject ( const list <item> *list ) : code ( 0 ), indices ( list ) {} //error: can not convert parameter 1 const list <item> const tset <item>  };   and there problems structure initialization.
error: can not convert parameter 1 const list <item> const tset <item>   where problem?
why expect conversion list tset if did not write one?  also, type of indices needs typename on front since dependent type.
Comments
Post a Comment