struct DataItem { int dataType; void *data;};typedef vector< vector<DataItem *> > DataItemContainer;DataItemContainer *allOfMyData;allOfMyData = new DataItemContainer;...
C++ (Qt) std::vector<GLfloat> m_vertices; std::vector<GLfloat> m_textures; std::vector<GLuint> m_indices; // ... m_vertices.push_back( -50.0f ); //X m_vertices.push_back( -50.0f ); //Y m_vertices.push_back( 0.0f ); //Z m_vertices.push_back( 50.0f ); //X m_vertices.push_back( -50.0f ); //Y m_vertices.push_back( 0.0f ); //Z m_vertices.push_back( 50.0f ); //X m_vertices.push_back( 50.0f ); //etc.. m_vertices.push_back( 0.0f ); // ... glVertexPointer( 3, GL_FLOAT, 0, m_vertices.data() ); glTexCoordPointer( 2, GL_FLOAT, 0, m_textures.data() ); // ...
C++ (Qt)int arr[10]
C++ (Qt)std::vector<int> arr(10);
C++ (Qt)std::vector<int> arr;arr.resize( 10 );
C++ (Qt)#include <iostream>#include <memory> struct Person{ std::string firstName; std::string lastName;}; int main(){ // Create object auto p = std::make_shared<Person>(); // Use object p->firstName = "Ivan"; std::cout << p->firstName << std::endl; return 0;}
C++ (Qt)#include <iostream> struct Person{ std::string firstName; std::string lastName;}; int main(){ // Create object Person *p = new Person; // Use object p->firstName = "Ivan"; std::cout << p->firstName << std::endl; // Delete object delete p; return 0;}
data[pos] = dt;
// Create object Person *p = new Person; // Use object p->firstName = "Ivan"; std::cout << p->firstName << std::endl; // Delete object delete p;
C++ (Qt) std::vector< std::vector<int> > arr( 5 );
C++ (Qt)int * a = &vec[0];