Thread: Templated Classes with Templated Functions

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    569

    Templated Classes with Templated Functions

    Based on reading here:

    Cprogramming.com - Tutorials - Templated Functions

    I understand that such thing is possible, however I have the following code:

    Code:
    template <int X, int Y>
    class Simulator
    {
    public:
      template<int N, int N1>
      void doom::vector<State, N>& run(doom::vector<Input, N1>& input, double ts);
    protected:
      //some variables here
    }
    
    
    //here's my implementation
    template <int X, int Y>
    template<int N, int N1>
    const doom::vector<State, N>& Simulator<X,Y>::run(doom::vector<Input, N1>& input, double ts);
    {
     //some code here
     return x;
    } 
    
    
    //here's my test
    int main(){
    Simulator<25, 25> s( new Vehicle( WB ) );
    doom::vector<Input, 25> u = InputLibrary::getSimpleInputSet( );
    //this is where the error happened
    doom::vector<State, 25> x = s.run( u, 0.1 );
    }

    my error is the following:
    error: no matching function for call to âSimulator<25, 25>::run(ece373::vector<ece373::vector<double, 2>, 25>&, double)â
    Last edited by -EquinoX-; 11-22-2009 at 05:13 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. classes and functions
    By cpudaman in forum C++ Programming
    Replies: 20
    Last Post: 12-18-2007, 02:45 AM
  2. Help w/ classes and functions
    By Relikie in forum C++ Programming
    Replies: 7
    Last Post: 11-04-2007, 08:42 AM
  3. Cannot declare STL iterators in custom templated classes!
    By Maelstrom in forum C++ Programming
    Replies: 8
    Last Post: 03-03-2006, 07:58 PM
  4. Classes being able to use other classes functions
    By rainmanddw in forum C++ Programming
    Replies: 6
    Last Post: 01-29-2006, 11:19 AM
  5. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM