Skip to content

Commit c4a9d5b

Browse files
committed
remove use of std::ptr_fun
1 parent dfc289a commit c4a9d5b

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

libsrc/eclib/templates.h

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ using std::map;
6161
using std::unordered_map;
6262
using std::min;
6363
using std::max;
64-
using std::ptr_fun;
6564
using std::pair;
6665
using std::sort;
6766
using std::abs;

libsrc/saturate.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,15 @@ int saturator::do_saturation(int pp, int maxntries)
356356
int l2i(long i) {return (int)i;}
357357
vector<int> lv2iv(const vector<long>& v)
358358
{
359-
vector<int> ans;
360-
transform(v.begin(),v.end(),inserter(ans,ans.end()),ptr_fun(l2i));
359+
vector<int> ans(v.size());
360+
transform(v.begin(),v.end(),ans.begin(), l2i);
361361
return ans;
362362
}
363363
int i2l(int i) {return (long)i;}
364364
vector<long> iv2lv(const vector<int>& v)
365365
{
366-
vector<long> ans;
367-
transform(v.begin(),v.end(),inserter(ans,ans.end()),ptr_fun(i2l));
366+
vector<long> ans(v.size());
367+
transform(v.begin(),v.end(),ans.begin(),i2l);
368368
return ans;
369369
}
370370

tests/ptest.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ int main()
4848

4949
n=2310*210*64*17;
5050
cout<<"n = "<<n<<endl;
51-
vector<long> exps;
5251

53-
transform(plist.begin(),plist.end(),inserter(exps,exps.end()),
54-
bind2nd(ptr_fun(val),n));
52+
vector<long> exps(plist.size());
53+
transform(plist.begin(),plist.end(),
54+
exps.begin(),
55+
[n](long p) {return val(p,n);}
56+
);
57+
5558
cout<<"exps = "<<exps<<endl;
5659

5760
vector<long> plist1=primes(10);

0 commit comments

Comments
 (0)