「The problem about a function as a functor」の編集履歴(バックアップ)一覧はこちら
「The problem about a function as a functor」(2005/07/26 (火) 17:23:04) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
下面的程序为什么要这样修改才可以呢?
&html(<quote>
[code]
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
using namespace std;
int main()
{
vector<double> v1;
for ( int i = 0; i < 10; ++i ) {
v1.push_back( i );
}
vector<double> v2( v1.size() );
// transform( v1.begin(), v1.end(), v2.begin(), exp );
transform( v1.begin(), v1.end(), v2.begin(), ::exp );
copy( v2.begin(), v2.end(), ostream_iterator<double>( cout, " " ) );
cout << endl;
}
[/code]
</quote>)
下面的程序为什么要这样修改才可以呢?
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
using namespace std;
int main()
{
vector<double> v1;
for ( int i = 0; i < 10; ++i ) {
v1.push_back( i );
}
vector<double> v2( v1.size() );
// transform( v1.begin(), v1.end(), v2.begin(), exp );
transform( v1.begin(), v1.end(), v2.begin(), ::exp );
copy( v2.begin(), v2.end(), ostream_iterator<double>( cout, " " ) );
cout << endl;
}
表示オプション
横に並べて表示:
変化行の前後のみ表示: