Skip to content

Instantly share code, notes, and snippets.

@bramblex
Created September 20, 2017 07:06
Show Gist options
  • Select an option

  • Save bramblex/bab9005563c48cddffe807eb73f0408e to your computer and use it in GitHub Desktop.

Select an option

Save bramblex/bab9005563c48cddffe807eb73f0408e to your computer and use it in GitHub Desktop.
Segment
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