我的女儿琴四月 韩语:GP/STL代码问题

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/11 03:00:35
今天看了STL,茫然,不知所错,请高手告诉这段代码啥意思,在做什么,或帮我注释一下,或帮我用VB或PASCAL写出来,谢谢.
const pair<bool,map<string,string> > post_decodes( const string::const_iterator& begin, const string::const_iterator& end )
{
pair<bool,map<string,string> > ret;
ret.first = false;
map<string,string>& hs = ret.second;

string::const_iterator p=begin,p1=begin,p2=begin;
for( ; p!=end; ++p )
{
if( *p == '=' )
{
p2 = p;
}
else if( *p == '&' )
{
if( p1 >= p2 ) // error
return ret;
const pair<bool,string> _key = post_decode( p1, p2 );
if( !_key.first || _key.second.empty() ) return ret;
++p2;
const pair<bool,string> _val = post_decode( p2, p );
if( !_val.first ) return ret;
p1 = p;
++p1;

hs[ _key.second ] = _val.second;
}
}
if( p2 != begin )
{
if( p1 >= p2 ) // error
return ret;
const pair<bool,string> _key = post_decode( p1, p2 );
if( !_key.first || _key.second.empty() ) return ret;
++p2;
const pair<bool,string> _val = post_decode( p2, p );
if( !_val.first ) return ret;

hs[ _key.second ] = _val.second;
}
ret.first = true;
return ret;
}
const pair<bool,map<string,string> > post_decodes( const string& scr )
{
return post_decodes( scr.begin(), scr.end() );
}

这个你还是找本stl相关的书看看,一句两句是说不清楚的。
GP and the STL, The C++ Standard Library都不错