I wanted to do
typedef deque type; //error, use of class template requires template argument list
type<int> container_;
But that error is preventing me. How do I do this?
I wanted to do
typedef deque type; //error, use of class template requires template argument list
type<int> container_;
But that error is preventing me. How do I do this?
You don't, C++ does not yet support this kind of typedef. You can of course say;
typedef std::deque <int> IntDeque;
deque is not a type. It is a template, used to generate a type when given an argument.
deque<int>
is a type, so you could do
typedef deque<int> container_
You hit an error because you missed to specify int in deque.
But note that: Template typedef's are an accepted C++0x feature. Try with the latest g++
The way you could do this is:
#define type deque
But that comes with several disadvantages.
You can't (until C++0x). But it could be emulated with:
template<typename T>
struct ContainerOf
{
typedef std::deque<T> type;
};
used as:
ContainerOf<int>::type container_;