Created
February 26, 2018 14:16
-
-
Save pedrovanzella/9fc0161cac6c29b38a0d8e8838e7b619 to your computer and use it in GitHub Desktop.
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
class Memory { | |
public: | |
Memory(std::array<uint8_t, 1024> b) { buff_ = std::move(b); } | |
uint16_t& operator[](uint16_t addr) { | |
return (buff_[addr] << 8) + buff_[addr + 1]; // This doesn't work | |
// cannot bind non-const lvalue reference of type ‘uint16_t& {aka short unsigned int&}’ to an rvalue of type ‘uint16_t {aka short unsigned int}’ | |
} | |
private: | |
std::array<uint8_t, 1024> buff_; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment