How do I typedef a template?

Started by
3 comments, last by gimp 23 years, 2 months ago
I use std::vector quite a lot but I use it in ways that it shouldn''t support (like memcopying between beginning and end). One day if this gives me problems I''ll write my own array class however I don''t want to have to rewrite large portions of my code so I''d like to typedef std::vector to CArray. That way if I ever need to drop vectors I can just replace the typedef with an implementation. typedef std::vector CArray doesn''t work however... Is this a syntax thing? thanks chris
Chris Brodie
Advertisement
You have to also specify the template parameter list

  typedef std::vector<int> intvect;  
Doh... Thats what I was hoping to avoid...
Chris Brodie
i think if you make CArray inherit from Vector,you can use CArray or CArray as your wish, and you can change to another container implemetation by modify the CArray''s definition, it wouldn''t take lots of time.

------------------------------
Dedicate to nobody, I''m nobody
------------------------------------------------------CCP is fascistic, they even banned www.sourceforge.net
oh god rides the flaw, the board changed my post:

  CArray<int> or CArray<YourClass>  


------------------------------
Dedicate to nobody, I''m nobody
------------------------------------------------------CCP is fascistic, they even banned www.sourceforge.net

This topic is closed to new replies.

Advertisement