프로그래밍/c++

boost::uuids::uuid를 std::unordered_map과 사용하기

제페 2015. 11. 5. 02:55
반응형
uuid(universal unique identifier)는 객체의 식별 등에 사용되는 고유한 식별자이다. 
식별을 위한 정수 값 0, 1, 2 등의 것을 심화시킨 것이라고 생각해도 무관.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma warning(disable : 4996)
 
#include <unordered_map>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid.hpp>
 
 
using uuid_hasher = boost::hash<boost::uuids::uuid>;
/* c++11 이하 버전에선 
  typedef boost::hash<boost::uuids::uuid> uuid_hasher
*/
 
 
int main()
{
  std::unordered_map<boost::uuids::uuid, int, uuid_hasher> uuidmap;
  
  return 0;
}
cs



ps. vs2015 2015/11/05 기준, 버그가 있는지 uuid_generators를 포함하면 위험 경고가 발생하면서 빌드가 안 되는데, #pragma warning(disable: 4996)을 명시하면 사라진다. -_-;




반응형