Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef SAVIEW_H
- #define SAVIEW_H
- #include <vector>
- #include <algorithm>
- template <typename T>
- class sorted_array_view {
- private :
- std::vector<T> original;
- T* array;
- public :
- sorted_array_view(T _array[], int _size) : array(_array), original(_array,_array+_size) {
- std::sort(array, array+_size);
- }
- ~sorted_array_view() {
- std::copy(original.begin(), original.end(), array);
- }
- int size() const {
- return original.size();
- }
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement