Original Post
Hey, I've been working on a project of mine and I use a container class I created to manage certain data types I might have. I call this class "sequence" and it uses a static filled array to hold the data.
My problem is that I'm trying to convert this class to a class which is pretty easy, yet my compiler (MC Visual C++ 6.0) is giving me weird errors.
Heres some snippits of code that the errors pertain to
The error I get is "C2512 - 'character': no appropriate default constructor available". Its weird because it works if I put 'int' or 'char' in as my template data (eg. sequence theInts
but not for character. Seems like the sequence should be able to contain any kind of data, even objects. Can anyone help me out on what I am doing wrong here? Hope I was clear enough...thanks for the help
[edited by - Elwren on May 16, 2003 11:11:20 AM]
// sequence.h
template <class Item>
class sequence
{
public:
typedef Item value_type;
sequence();
// other stuff
private:
value_type data[CAPACITY];
// stuff
};
#include "sequence.template"
// sequence.template
// CONSTRUCTOR
template <class Item>
sequence<Item>::sequence()
{
used = 0;
current_index = used;
}
// other stuff
// main.C
// character is another class I have defined
int main() {
sequence<character> thePlayers;
//other stuff
}