|
-
July 10th, 2012, 07:17 PM
#1
find a type based on value ?
Another fun question...
Is it possible to make a type, based on a value ?
What I'm looking for is way to return the smallest (sizeof) unsigned integral type that will hold a certain value.
smallest_type<14>::type // unsigned char
smallest_type<127>::type // unsigned char
smallest_type<255>::type // unsigned char
smallest_type<256>::type // unsigned short
smallest_type<64000>::type // unsigned short
smallest_type<128000>::type // unsigned long
smallest_type<5000000000>::type // unsigned long long
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|