Panagiotis Filianos Panagiotis Filianos - 1 year ago 85
C++ Question

Bitset inside template declaration

I would like to know if it is possible to have bitset inside a template declaration like so:

ListData<bitset<64>>* hamming = new ListData<bitset<64>>();

ListData is class containing a T element like so:

template <typename T>
class ListData {
T number;

The compiler says that the template argument invalid and that hamming was not declared in this scope.
Any idea?

p.s. I am unable to use C++ vector containers due to my assignment's restrictions

Answer Source

I found the answer. It turns out the compiler thought ">>" in:

ListData<bitset<64>>* hamming = new ListData<bitset<64>>();

was recognised as the overloaded operator >>.

ListData<bitset<64> >* hammingList = new ListData<bitset<64> >();

Thus the above fixes the problem.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download