joining head to tail

This is a discussion on joining head to tail within the C++ Programming forums, part of the General Programming Boards category; a little help please - i am having a hard time why the compiler Could not find a match for ...

  1. #1
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    839

    joining head to tail

    a little help please - i am having a hard time why the compiler

    Could not find a match for 'join<H1,H2,T2,T>(varnode<int,end>,varnode<int,end >)'

    what am i doing wrong that it's not deducing to the case i am trying for &/or not matching the function signature?



    thanks in advance.

    Code:
    template<typename H,typename T>class varnode
    {
        public:
        varnode(tVar<H> h,T t):
            head(h),
            tail(t)
        {
        }
        tVar<H> head;
        T tail;
    };
    
    class end
    {
    };
    
    //...
    
    //recurse through head until terminus is reached
    template<typename H1,typename T1,typename H2,typename T2,typename T> varnode<H1,T> join(varnode<H1,T1>head,varnode<H2,T2>tail)
    {
        return varnode<H1,T>(head.head,join(head.tail,tail));
    }
    
    //specialization case to terminate join recursion
    template<typename H1,typename H2,typename T2,typename T> varnode<H1,T> join<H1,end,H2,T2,T>(varnode<H1,end>head,varnode<H2,T2>tail)
    {
        return varnode<H1,T>(head.head,tail);
    }
    
    
    
    //...
     
        int i1;
        int i2;
    
        tVar<int>iv1("int1",i1);
        tVar<int>iv2("int2",i2);
    
        varnode<int,end>head(iv1,end());
        varnode<int,end>tail(iv2,end());
        varnode<int,varnode<int,end> >v(head.head,tail);
        join(head,tail);
    Last edited by m37h0d; 04-07-2009 at 01:04 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. xor linked list
    By adramalech in forum C Programming
    Replies: 23
    Last Post: 10-14-2008, 10:13 AM
  2. Pleas take a look & give a critique
    By sh3rpa in forum C++ Programming
    Replies: 14
    Last Post: 10-19-2007, 10:01 PM
  3. Can't figure out problem with code
    By Beast() in forum C Programming
    Replies: 4
    Last Post: 04-16-2005, 05:27 PM
  4. Linked List Help
    By Perverse in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2005, 07:33 AM
  5. change stack to a queue
    By sballew in forum C Programming
    Replies: 12
    Last Post: 12-03-2001, 10:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21