- 468 名前:デフォルトの名無しさん mailto:sage [2010/01/09(土) 22:33:27 ]
- >466
そのリンクの最後の回答をちょい修正して #include <iostream> #include <boost/lexical_cast.hpp> template<typename T> class from_hex // For use with boost::lexical_cast { T value; public: operator T() const { return value; } friend std::istream& operator>>( std::istream& is, from_hex<T>& outValue ) { is >> std::hex >> outValue.value; return is; } }; int main(void) { std::cout << boost::lexical_cast<from_hex<int> >("0x12345") << std::endl; return 0; } でいいんじゃね?
|

|