diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-25 01:37:13 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-25 01:45:00 +0100 |
commit | 5b1f0ac8c2529cb5fa1085a0cac797d937df1119 (patch) | |
tree | 7f1bd66bda149e6c05b9310525168f885c21d266 /entity | |
parent | 0223fe52b79ca4320121eeb02d5d4d904f6b48fd (diff) |
entity: allow readers to const fields
Diffstat (limited to 'entity')
-rw-r--r-- | entity/concepts.hpp | 5 |
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; } }; |