Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T>
- class Array : public std::vector<T>
- {
- public:
- explicit Array(const typename _Alloc& all)
- : std::vector<T>(all)
- {
- }
- explicit Array(size_type n, const T& value = T(), const typename _Alloc& all = _Alloc())
- : std::vector<T>(n, value, all)
- {
- }
- explicit Array()
- : std::vector<T>()
- {
- }
- template<int size>
- Array(T (&values)[size])
- : std::vector<T>(sizeof(values) / sizeof(T))
- {
- std::copy(values, values + sizeof(values) / sizeof(T), begin());
- }
- const T* Pointer() const { return &front(); }
- void operator +=(const T& value)
- {
- push_back(value);
- }
- void ForEach(std::tr1::function<void (T&)> fun)
- {
- std::for_each(begin(), end(), fun);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement