New to templates and lists but i have to use them for a class project. I got it working in one file then i tried to make it a class and I keep getting this error:

1>c:\users\r4ck13y\programming\c++ projects\project2.1\project2.1\merginglists.h(11) : error C2955: 'std::list' : use of class template requires template argument list
1> c:\program files\microsoft visual studio 9.0\vc\include\list(95) : see declaration of 'std::list'

Here is the header file that im about 90% sure the error is coming from. Please help. Thank you.

#ifndef MERGINGLISTS
#define MERGINGLISTS
#include "stdafx.h"
#include <list>
#include <iostream>
using namespace std;
class MergingLists : public list
{
public:
	MergingLists();
	template <typename T>	void splitlist(list<T> L, list<T>& first, list<T>& second);
	template <typename T>	list<T> merge(list<T>& first, list<T>& second);
	template <typename T>	list<T> mergesort(list<T>& L);
};
#endif

>>class MergingLists : public list
AFAIK a template can not be used as a base class to non-template c++ class.

You know most of the time the error says it all :

::list' : use of class template requires template argument list

You have this

class MergingLists : public list

The error tells you that list uses templates so that means that
your MergingLists has to also be a template class if you want
to inherit from list.

So you can either change your code to this

template<typename Type>
class MergingLists : public list<Type>

Or you can just inherit one type like so :

typedef int Type;
class MergingLists : public list<Type>{}

For the second one you can only have 1 Type, so Type can either be
int,string,float, or double, but not all; Whereas the first one can be
any.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.