[ create a new paste ] login | about

Link: http://codepad.org/9g1ob0pD    [ raw code | output | fork ]

C++, pasted on Nov 5:
#include <vector>

template <class T, int N, class Allocator = std::allocator<T> >
class Vector : protected std::vector<T, Allocator>
{
public:
    using std::vector<T, std::allocator<T> >::iterator;
    using std::vector<T>::get_allocator;
    using std::vector<T>::max_size;
    using std::vector<T>::size;
    using std::vector<T>::empty;
    using std::vector<T>::capacity;
    using std::vector<T>::assign;
    using std::vector<T>::begin;
    using std::vector<T>::end;
    using std::vector<T>::rbegin;
    using std::vector<T>::rend;
    using std::vector<T>::operator[];
    using std::vector<T>::at;
    using std::vector<T>::resize;
    using std::vector<T>::front;
    using std::vector<T>::back;
    using std::vector<T>::push_back;
    using std::vector<T>::pop_back;
    using std::vector<T>::insert;
    using std::vector<T>::erase;
    using std::vector<T>::clear;
    using std::vector<T>::swap;
    
    explicit Vector(const Allocator& = Allocator()) : std::vector<T, Allocator>() {
        this->reserve(N);
    }
};

int main()
{
	Vector<int, 100> v;
	
	printf("capacity:%d, size:%d¥n", v.capacity(), v.size());
}


Output:
1
capacity:100, size:0¥n


Create a new paste based on this one


Comments: