I\'m using libgc, a garbage collector for C and C++. To make STL containers garbage collectible one must use the gc_allocator.
Instead of writing
s
You cannot use a "templated typedef", but you can use a convenience class/struct with an inner type:
template
struct TypeHelper{
typedef std::vector > Vector;
};
and then use in your code
TypeHelper::Vector v;
TypeHelper::Vector::iterator it;
And something similar for the map:
template
struct MapHelper{
typedef std::map > Map;
};
EDIT - @Vijay: I don't know if there's another possible workaround, that's how I would do it; a macro might give you a more compact notation, but personally I wouldn't like it:
#define GCVECTOR(T) std::vector >
EDIT - @chmike: Please note that the TypeHelper solution does not require you to redefine constructors!