これは うごかない
#include <stdlib.h> #include <iostream> #include <string> #include <vector> using namespace std; class Test{ private: bool m_bool; vector<bool> m_vector; public: Test(){ m_bool = false; m_vector.push_back(true); m_vector.push_back(false); m_vector.push_back(true); } bool& testbool(){ return m_bool; } bool& testvector(int index_){ return m_vector[index_]; } void put(){ cout << "m_integer: " << m_integer << endl; vector<bool>::iterator iter; cout << "m_vector: "; for(iter=m_vector.begin(); iter != m_vector.end(); iter++){ cout << *iter << " "; } cout << endl; } }; int main(){ Test* t = new Test(); t->put(); t->testbool() = true; t->put(); t->testvector(1) = true; t->put(); return 0; }
うごかない