How to enforce const -ness on Python side
#1306
-
|
Dear all, Example: The Alternatives:
but in this case I would lose all other methods I am not an experienced C++ developer, so this question might be trivial or silly, but I will appreciate any hint from the community. Regards, W |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
nanobind (like Python) has no concept of |
Beta Was this translation helpful? Give feedback.
nanobind (like Python) has no concept of
const-ness, and will not have such a feature in the future. So this ultimately isn't a nanobind question. You could have a read-only base class. Or you could export implementations to separate regular and view classes without inheritance relationship via the curiously recurring template pattern (CRTP).