No viable overloaded operator[] for type 'vector<bitset>' c++ -



No viable overloaded operator[] for type 'vector<bitset<8>>' c++ -

i maintain getting error:

no viable overloaded operator[] type 'vector<bitset<8>>'

i trying execute while hex value not contained within vector. guess error has way trying check element. if tell me how check vector defined constant great. here basic code:

using namespace std; //variables trying compare #define halt_opcode 0x19; vector<bitset<8> > memory(65536); bitset<16> pc = 0; int main(int argc, const char * argv[]) { //error occurs here while(memory[pc] != halt_opcode){ fetchnextinstruction(); executeinstruction(); } homecoming 0; }

i not see sense in construction

while(memory[pc] != halt_opcode){ cout << "do something";

but in case have write

while(memory[pc.to_ulong()].to_ulong() != halt_opcode){ cout << "do something";

or

while(memory[pc.to_ulong()] != halt_opcode){ cout << "do something";

because there non-explicit conversion constructor in class std::bitset.

c++ vector hex bitset

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -