Skip to content

Commit

Permalink
remove use of std::ptr_fun
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCremona committed Dec 12, 2023
1 parent dfc289a commit c4a9d5b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion libsrc/eclib/templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ using std::map;
using std::unordered_map;
using std::min;
using std::max;
using std::ptr_fun;
using std::pair;
using std::sort;
using std::abs;
Expand Down
8 changes: 4 additions & 4 deletions libsrc/saturate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,15 @@ int saturator::do_saturation(int pp, int maxntries)
int l2i(long i) {return (int)i;}
vector<int> lv2iv(const vector<long>& v)
{
vector<int> ans;
transform(v.begin(),v.end(),inserter(ans,ans.end()),ptr_fun(l2i));
vector<int> ans(v.size());
transform(v.begin(),v.end(),ans.begin(), l2i);
return ans;
}
int i2l(int i) {return (long)i;}
vector<long> iv2lv(const vector<int>& v)
{
vector<long> ans;
transform(v.begin(),v.end(),inserter(ans,ans.end()),ptr_fun(i2l));
vector<long> ans(v.size());
transform(v.begin(),v.end(),ans.begin(),i2l);
return ans;
}

Expand Down
9 changes: 6 additions & 3 deletions tests/ptest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ int main()

n=2310*210*64*17;
cout<<"n = "<<n<<endl;
vector<long> exps;

transform(plist.begin(),plist.end(),inserter(exps,exps.end()),
bind2nd(ptr_fun(val),n));
vector<long> exps(plist.size());
transform(plist.begin(),plist.end(),
exps.begin(),
[n](long p) {return val(p,n);}
);

cout<<"exps = "<<exps<<endl;

vector<long> plist1=primes(10);
Expand Down

0 comments on commit c4a9d5b

Please sign in to comment.