본문 바로가기
프로그래밍/c++

STL 컨테이너들의 사이즈를 한번 출력해 봤다..

by 긱플레이어 2011. 1. 24.




#include "stdafx.h"
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define print_sizeof(x) std::cout << "sizeof " << #x << '\t' << sizeof(x) << std::endl;
void main()
{
	std::string str1;
	print_sizeof(str1);

	std::wstring str2;
	print_sizeof(str2);

	std::map< int, int > map1;
	print_sizeof(map1);

	std::vector< std::string > vec1;
	print_sizeof(vec1);

	std::list< std::string > list1;
	print_sizeof(list1);

	std::stack< std::string > stack1;
	print_sizeof(stack1);

	std::deque< std::string > deque1;
	print_sizeof(deque1);

	std::queue< std::string > queue1;
	print_sizeof(queue1);
}


각 컨테이너의 요소에 넣는 타입은 어떤걸 넣어도 같은 사이즈가 나왔다..





댓글