Created
September 20, 2017 07:06
-
-
Save bramblex/bab9005563c48cddffe807eb73f0408e to your computer and use it in GitHub Desktop.
Segment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <class T> | |
| struct Segment { | |
| private: | |
| unsigned long start; | |
| unsigned long _size; | |
| std::vector<T>* content; | |
| public: | |
| Segment(std::vector<T> &content){ | |
| this->content = &content; | |
| } | |
| unsigned long size(){ | |
| return this->_size; | |
| } | |
| void reset(unsigned long start, unsigned long size) { | |
| this->start = start; | |
| this->_size = size; | |
| } | |
| T& operator[](unsigned long index){ | |
| return (*(this->content))[index + this->start]; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment