SourceForge.jp

to_string.h

説明を見る。
00001 #ifndef __STX_TO_STRING_H__
00002 #define __STX_TO_STRING_H__
00003 
00004 #include <sstream>  // ostringstream
00005 #include <utility>  // pair
00006 
00007 
00008 namespace stx{
00009 
00010 
00011 template<class Iterator>
00012 std::string _to_string(Iterator first, Iterator last) {
00013   std::ostringstream strm; 
00014   while ( first != last ) {
00015     strm << *first++;
00016     if ( first != last ) strm << ' ';
00017   }
00018   return strm.str();    
00019 }
00020 
00021 template<class Iterator>
00022 std::string to_string(Iterator first, Iterator last) {
00023   std::ostringstream strm; 
00024   strm << '[' << _to_string(first,last) << ']';
00025   return strm.str();
00026 }
00027 
00028 template<class Iterator>
00029 std::string to_string(Iterator first, Iterator middle, Iterator last) {
00030   std::ostringstream strm; 
00031   strm << '[' << _to_string(first,middle) 
00032        << '|' << _to_string(middle,last) << ']';
00033   return strm.str();
00034 }
00035 
00036 template<class Iterator>
00037 std::string to_string(Iterator first, Iterator lower, Iterator upper, Iterator last) {
00038   std::ostringstream strm; 
00039   strm << '[' << _to_string(first,lower)
00040        << '(' << _to_string(lower,upper) << ')'
00041        << _to_string(upper,last) << ']';
00042   return strm.str();
00043 }
00044 
00045 template<class Iterator>
00046 inline std::string to_string(Iterator first, std::pair<Iterator,Iterator> middle, Iterator last) {
00047   return to_string(first,middle.first,middle.second,last);
00048 }
00049 
00050 
00051 
00052 }//end of stx namespace
00053 
00054 #endif

dkutil 1.02リリース前 d金魚専用マニュアルバージョンに対してSun Dec 28 21:23:08 2003に生成されました。 doxygen 1.3.5