Thread: VC 7.0 and templates

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    You are right. I don't use templates to your extent although I do use them A LOT like templated member functions (which do work fine), default templates and etc. Looking into the docs, the compiler tells you you can't do certain things with templates. Oh well that sux but those features are for limited use at least for me.

    I just don't understand your code.

    struct Item_type: template <class R> struct I_Wrapper
    template <class I=Item_type> class Container

    When expanded for Container<>::Item, this is what you get:
    X: Item <Item_Type::I_Wrapper <Container<Item_type> > >

    But then Container<Item_type>'s Item_type's I_Wrapper's R is not specified! Even so, it has to have an Item_list which is a list of Items which is X again. To evaluate the Item for the Item_list of X, it has to do it again and again. I sense an infinite loop in Container<> a! It has to evaluate Item_list over and over and over.

    So can anyone explain this code to me?
    Last edited by Speedy5; 03-10-2003 at 03:40 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Templates from DLL or static library problem
    By mikahell in forum C++ Programming
    Replies: 2
    Last Post: 01-01-2008, 01:49 AM
  2. Questions about Templates
    By Shamino in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2005, 12:22 AM
  3. templates and inheritance problem
    By kuhnmi in forum C++ Programming
    Replies: 4
    Last Post: 06-14-2004, 02:46 AM
  4. When and when not to use templates
    By *ClownPimp* in forum C++ Programming
    Replies: 7
    Last Post: 07-20-2003, 09:36 AM