On 07/21/2017 11:49 AM, Cecil Ward wrote:
I was think about how to create a new type that holds packed bcd values, of a choice of widths, that must fit into a uint32_t or a uint64_t (not really long multi-byte objects). I am not at all sure how to do it. I thought about using a templated struct to simply wrap a uint of a chosen width, and perhaps use alias this to make things nicer.
Andrei's checkedint may give ideas: https://dlang.org/phobos/std_experimental_checkedint.html He presented it in this talk: http://dconf.org/2017/talks/alexandrescu.html ... which is missing the following video link: https://www.youtube.com/watch?v=29h6jGtZD-U ... which has a longer version: https://www.youtube.com/watch?v=es6U7WAlKpQ Ali