#include <iostream>
#include <algorithm> //STL 알고리즘 함수
#include <vector> //vector 컨테이너 h
using namespace std;
#include <time.h>
//data class
class Member
{
string name;
int age;
public:
Member(string _name, int _age)
:name(_name), age(_age)
{
}
void Print() const
{
cout << name.c_str() << " / " << age << endl;
}
};
void fun_Print(vector<int*> vec1)
{
//현재 저장 개수
cout << "사이즈 : " << vec1.size() << endl;
//저장할 수 있는 생성된 공간
cout << "크기 : " << vec1.capacity() << endl;
//저장할 수 있는 최대 저장공간
cout << "max : " << vec1.max_size() << endl;
}
int main()
{
vector<int*> vec1; // max?
fun_Print(vec1);
vec1.push_back(new int(1));
vec1.push_back(new int(2));
vec1.push_back(new int(3));
vec1.push_back(new int(3));
vec1.push_back(new int(3));
vec1.push_back(new int(3));
vec1.push_back(new int(3));
vec1.push_back(new int(3));
fun_Print(vec1);
return 0;
}
'01.Bit 단기 > C++' 카테고리의 다른 글
53_vector 참조(저장, 검색 수정 삭제 등) (0) | 2018.05.10 |
---|---|
52_컨테이너와 find (0) | 2018.05.10 |
50_배열 템플릿 사용자 정의클래스 (0) | 2018.05.09 |
49_배열 템플릿(overflow, pushback, erase 구현) (0) | 2018.05.09 |
48_템플릿클래스로 변경 (0) | 2018.05.09 |
댓글