Skip to content

Instantly share code, notes, and snippets.

@shawnchin
Created May 9, 2012 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawnchin/2643718 to your computer and use it in GitHub Desktop.
Save shawnchin/2643718 to your computer and use it in GitHub Desktop.
class VectorWrapperBase {
public:
virtual ~VectorWrapperBase() {}
virtual void reserve(unsigned int n) = 0;
};
template <typename T>
class VectorWrapper: public VectorWrapperBase {
public:
typedef T data_type;
typedef std::vector<T> vector_type;
void reserve(unsigned int n) { v_.reserve(n); }
private:
std::vector<T> v_;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment