Downcast on values and variables #248
Replies: 13 comments 23 replies
-
My current simplification progress have long functions. That's because I need to convert between types and values back and forth. If I were able to have the bases as values, and converting them to were as simple as I know that the NTTPs can look awful in error messages. I'm not suggesting we change that right now. But we can get close to have them easily convertible to values, both to preserve good error messages and simplify the TMP. |
Beta Was this translation helpful? Give feedback.
-
Regarding |
Beta Was this translation helpful? Give feedback.
-
Please do not make this library depend on boost. |
Beta Was this translation helpful? Give feedback.
-
I also thought about something like |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, it is true. We have to try modules soon. I still do not know how to handle them with CMake. Do you have any experience with it? |
Beta Was this translation helpful? Give feedback.
-
Why |
Beta Was this translation helpful? Give feedback.
-
Having a downcasting facility working fine for values is AWESOME!!! It opens the doors to many possible enhancements. I mentioned them several times already (i.e. #166 (comment)). The library could be much simpler if dimensions were NTTPs and it would also allow providing abstract arithmetic just on dimension values (without quantity magnitude/value and units). |
Beta Was this translation helpful? Give feedback.
-
I am not sure if a unit should be an NTTP. Do you see any benefits of it being one over a regular type? I always thought that the list of exponents in a dimension should be an NTTP and that we should use plain algorithms to handle them (if compile-time performance will be OK). But again dimensions could be types again (also as I stated above doing generic arithmetic just on the dimensions would be COOL). Not everything has to be an NTTP just because we can now 😉... |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I realize that it'd be easier to provide |
Beta Was this translation helpful? Give feedback.
-
I don't plan on deviating from the current design of |
Beta Was this translation helpful? Give feedback.
-
I wish I had tested that on CE. MSVC actually works quite nicely. I reduced it and did my first MSVC bug report: https://developercommunity.visualstudio.com/t/values-of-class-type-with-subobjects-of-pointer-va/1369047. |
Beta Was this translation helpful? Give feedback.
-
Seems like Clang is prone to drop the diamonds of a variable template in non-simple expressions:
Diamonds of types are kept:
|
Beta Was this translation helpful? Give feedback.
-
It's possible now: https://godbolt.org/z/MePezh. And variables too: https://godbolt.org/z/hfqja1. I hope it's useful to you. I'm hoping to simplify all the TMP machinery of the library. See https://github.com/mpusz/units/compare/master...johelegp:nttp?expand=1, specially the "Goal:" comments.
Beta Was this translation helpful? Give feedback.
All reactions