- 5 名前:1/2 mailto:sage [2007/11/02(金) 10:31:38 ID:vzRmdmZ8]
- とりあえずそれなりにC++っぽく作ってみた(要boost)
効率はそんなに良くないと思う #define NOMINMAX #include <windows.h> #include <string> #include <limits> #include <iostream> #include <algorithm> #include <functional> #include <boost/mpl/plus.hpp> #include <boost/mpl/int.hpp> #include <boost/array.hpp> namespace mpl = boost::mpl; struct IntToFullSizeWSTR : std::unary_function<int,std::wstring> { result_type operator()(argument_type i); private: typedef mpl::plus<mpl::int_<std::numeric_limits<int>::digits10>, mpl::int_<3> > buffer_size; boost::array< wchar_t, buffer_size::value > i2w_buf, half2full_buf; } conv; int main() { std::wcout.imbue( std::locale("japanese") ); std::wcout << ::conv(std::numeric_limits<int>::min() ) << L"?" << ::conv(std::numeric_limits<int>::max()) << std::endl; }
|

|