Created
January 11, 2017 14:22
-
-
Save picanumber/12c209f9248df785d031714141f6893c to your computer and use it in GitHub Desktop.
Implementation of a binding element
This file contains 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 sorted_element | |
{ | |
std::remove_reference_t<T>* _data; | |
std::vector<std::size_t> const* _is; | |
sorted_element(T& elem, std::vector<std::size_t> const& is) | |
: _data(&elem), _is(&is) | |
{ | |
} | |
decltype(auto) operator[](std::size_t i) | |
{ | |
return _data->at(_is->at(i)); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment