소스 검색

test: refined custom id example

Michele Caini 5 년 전
부모
커밋
fc69e91636
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      test/example/custom_identifier.cpp

+ 4 - 3
test/example/custom_identifier.cpp

@@ -5,16 +5,17 @@
 
 struct entity_id {
     using entity_type = typename entt::entt_traits<entt::entity>::entity_type;
+    static constexpr auto null = entt::null;
 
-    entity_id(entity_type value = entt::null)
+    constexpr entity_id(entity_type value = null)
         : entt{value}
     {}
 
-    entity_id(const entity_id &other)
+    constexpr entity_id(const entity_id &other)
         : entt{other.entt}
     {}
 
-    operator entity_type() const {
+    constexpr operator entity_type() const {
         return entt;
     }