
On 27 Jul 2010, at 09:09, David Abrahams wrote:
At Mon, 26 Jul 2010 12:07:16 -0600, Matthias Troyer wrote:
I see the utility of augmenting STRONG_TYPEDEF but I wonder about it. if you have code T:base_type and T is not one of the types we're using - it won't have this available - compiler error. Wouldn't it be better to specify the implicit requirements as above and just know that T will be converted to what one wants? and sizeof(T) can be applied to both the (now) more elaborate types as well as C++ primitives.
The only problem I see with sizeof(T) is that it cannot tell me about signedness. Otherwise I could hack it from sizeof(T)
You should get the nested typedef; that is the non-hack solution. That said, I could write you a metafunction to discover signedness if you need it.
I can also write a meta function that will tell me which integral conversion is preferred and from that deduce the type, but that is indeed more prone to compiler bugs or other problems than a nested typedef.