Hi, in span.h you define a strange macro https://github.com/bitcoin/bitcoin/blob/965e93743454112c0c3c66bf24852f63ee07b862/src/span.h#L14
could someone please tell me the reasoning behind this? It doesn't seem to be mentionned in the comments, maybe I overlooked it.
The reason I don't understand is that it, as far as I know, does not have to change anything whatsoever in terms of code generation. Static initialization can happen without constexpr. (In fact it's a sneaky way to introduce bugs whenever you have a global std::map… It's a lot of "fun" but I digress).
Then we have this
https://github.com/bitcoin/bitcoin/blob/965e93743454112c0c3c66bf24852f63ee07b862/src/span.h#L116-L125
Now I'm very confused.
Is this checking if an incomplete type is convertible to another incomplete type?
I don't know how that template could possibly do anything else. It's not checking if T** is implicitly convertible to C**, is it? I don't know what that does.
Why is it only constexpr when not in debug? Why is it only doing this, rather important looking, assertion in debug? Does it become valid to violate that assertion in prod? Why? It seems odd and bug prone.
Thank you for your time.