일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- file
- 단축키
- 배열
- 영어
- texture
- AIR
- Mac
- XML
- 3d
- builder
- Ane
- 태그를 입력해 주세요.
- smartfoxserver
- flash builder
- path
- 게임
- Build
- iphone
- 경로
- Android
- ios
- Game
- unity
- AS3
- swf
- sdk
- class
- Flash
- unity3D
- 아이튠즈
Archives
- Today
- Total
상상 너머 그 무언가...
2차원 Vector에 포인트 객체 넣기 본문
2차원 vector 사용법을 알고나면
포인트 객체 사용하는거 말곤 큰 차이는 없는듯 하다.
// Example program
#include <iostream>
#include <string>
#include <stdio.h>
#include <array>
#include <vector>
struct profile {
char* name;
int age;
};
int main()
{
profile clack;
clack.name = "clack";
clack.age = 11;
std::cout << "clack name = " << clack.name <<"\n";
std::cout << "clack age = " << clack.age <<"\n";
std::vector<profile> profile_vec;
std::vector<profile*> profile_vec2;
profile kent;
kent.name = "kent";
kent.age = 12;
profile_vec.push_back(clack);
profile_vec.push_back(kent);
profile_vec2.push_back( new profile );
profile_vec2.push_back( new profile );
profile_vec2.push_back( &clack );
profile_vec2[1]->name = "olivia";
profile_vec2[1]->age = 13;
kent.age = 14;
std::cout << "profile_vec[1].age " << profile_vec[1].age <<"\n";
std::cout << "profile_vec2[1]->age " << profile_vec2[1]->age <<"\n";
std::cout << "profile_vec2[2]->name " << profile_vec2[2]->name <<"\n";
std::cout << "profile_vec2[2]->age " << profile_vec2[2]->age <<"\n";
std::vector<std::vector<profile*>> profile2dVector;
profile2dVector.push_back( profile_vec2 );
profile2dVector[0][1]->age = 15;
clack.age = 16;
std::cout << "profile2dVector[0][1]->name " << profile2dVector[0][1]->name <<"\n";
std::cout << "profile2dVector[0][1]->age " << profile2dVector[0][1]->age <<"\n";
std::cout << "profile2dVector[0][2]->name " << profile2dVector[0][2]->name <<"\n";
std::cout << "profile2dVector[0][2]->age " << profile2dVector[0][2]->age <<"\n";
std::cout << "test end" <<"\n";
}
clack name = clack
clack age = 11
profile_vec[1].age 12
profile_vec2[1]->age 13
profile_vec2[2]->name clack
profile_vec2[2]->age 11
profile2dVector[0][1]->name olivia
profile2dVector[0][1]->age 15
profile2dVector[0][2]->name clack
profile2dVector[0][2]->age 16
test end
그럼 이만