-
boost::uuids::uuid를 std::unordered_map과 사용하기프로그래밍/c++ 2015. 11. 5. 02:55반응형uuid(universal unique identifier)는 객체의 식별 등에 사용되는 고유한 식별자이다.식별을 위한 정수 값 0, 1, 2 등의 것을 심화시킨 것이라고 생각해도 무관.12345678910111213141516171819#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)을 명시하면 사라진다. -_-;
반응형'프로그래밍 > c++' 카테고리의 다른 글
[c++] std::vector를 boost::python::list로 (0) 2015.11.19 std::map insert, emplace, try_emplace (0) 2015.11.06 다양한 데이터 타입의 변수. boost::variant (0) 2015.11.02 std::bind 사용 예제 (0) 2015.10.25 unique_ptr 캐스팅 std::unique_ptr<Derived> => std::unique_ptr<Base> (0) 2015.10.18