[SUGGESTION] unsafe_narrow is not a good name for forced upcasts. #630
Replies: 6 comments
-
I call this |
Beta Was this translation helpful? Give feedback.
-
Yes, that is also possible. |
Beta Was this translation helpful? Give feedback.
-
By the way, |
Beta Was this translation helpful? Give feedback.
-
Thanks for pointing this out. I knew, that this can also be seen the other way round. I will start using it in terms of the type system and not the functionality. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Ok, |
Beta Was this translation helpful? Give feedback.
-
If you have e.g. expression templates, then the upcast to the implementing class needs to be done with
unsafe_narrow
.Maybe an alias of
unsafe_narrow
likeunsafe_cast
, 'unsafe_pointer_cast` or something like that could be introduced.Example: https://cpp2.godbolt.org/z/jb1MY3Mcq
Beta Was this translation helpful? Give feedback.
All reactions