Explorar el Código

feat: add reflection for const-only getter

Sam Jaffe hace 3 años
padre
commit
fc34dfe0ab
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      include/reflection/reflection.h

+ 6 - 0
include/reflection/reflection.h

@@ -57,6 +57,12 @@ public:
     const_members_.emplace(id, CONST_REFLECTION((obj.*get)()));
     return *this;
   }
+  
+  template <typename T>
+  Reflection & bind(std::string_view id, T (Obj::*get)() const) {
+    const_members_.emplace(id, CONST_REFLECTION((obj.*get)()));
+    return *this;
+  }
 
   template <typename T> Reflection & bind(std::string_view id, T Obj::*member) {
     members_.emplace(id, REFLECTION(obj.*member));