
Tor Brede Vekterli wrote:
Noah Roberts wrote:
Now someone just needs to make format<> :P
Although a tongue-in-cheek remark, the notion of a compile-time formatting library somehow appeals to me, if for nothing else for its sheer absurdity ;)
<snip>
int main(int argc, char* argv[]) { std::cout << mpl::c_str<itoa_ct::apply<12345>::type>::value << "\n"; std::cout << mpl::c_str<itoa_ct::apply<-98765>::type>::value << "\n"; std::cout << mpl::c_str<itoa_ct::apply<2009, 2>::type>::value << "\n"; std::cout << mpl::c_str<itoa_ct::apply<0xb0057, 16>::type>::value << "\n"; std::cout << mpl::c_str<itoa_ct::apply<0xffffffff, 16>::type>::value << "\n"; return 0; }
which outputs, as expected:
12345 -98765 11111011001 b0057 ffffffff
I'm swamped with thesis-work until June, so I cannot really do much else with this for now, but I just wanted to throw it out there. Any thoughts? :)
Whoa. Sick and twisted, but cool. I'm not sure what it's good for, though. After all, this: mpl::c_str<itoa_ct::apply<0xffffffff, 16>::type>::value is just an obfuscation of: "ffffffff" But it sure is fun. :-) -- Eric Niebler BoostPro Computing http://www.boostpro.com