summaryrefslogtreecommitdiffhomepage
path: root/entity/concepts.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-03-25 01:37:13 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-03-25 01:45:00 +0100
commit5b1f0ac8c2529cb5fa1085a0cac797d937df1119 (patch)
tree7f1bd66bda149e6c05b9310525168f885c21d266 /entity/concepts.hpp
parent0223fe52b79ca4320121eeb02d5d4d904f6b48fd (diff)
entity: allow readers to const fields
Diffstat (limited to 'entity/concepts.hpp')
-rw-r--r--entity/concepts.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/entity/concepts.hpp b/entity/concepts.hpp
index 682360dd..e30a2c5e 100644
--- a/entity/concepts.hpp
+++ b/entity/concepts.hpp
@@ -67,6 +67,11 @@ struct read_field<Obj, Type, Type (Obj::*)() const> {
};
template<typename Obj, typename Type>
+struct read_field<Obj, Type, const Type Obj::*> {
+ static constexpr Type read(const Obj& x, const Type Obj::*r) { return x.*r; }
+};
+
+template<typename Obj, typename Type>
struct read_field<Obj, Type, Type Obj::*> {
static constexpr Type read(const Obj& x, Type Obj::*r) { return x.*r; }
};