Remove use of std::bind2nd which is removed in C++17
This commit is contained in:
parent
c8cef5c2f2
commit
f3357f1f57
12 changed files with 24 additions and 31 deletions
|
|
@ -1581,8 +1581,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
std::transform(v.begin(), v.end(), v.begin(),
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::bind2nd(std::divides<double>(), 2.0));
|
*it /= 2.0;
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
// would you believe this is the same as the above?
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
*it /= 2.0;
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
// would you believe this is the same as the above?
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
*it /= 2.0;
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
// would you believe this is the same as the above?
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
*it /= 2.0;
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
// would you believe this is the same as the above?
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
*it /= 2.0;
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
// would you believe this is the same as the above?
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
*it /= 2.0;
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
// would you believe this is the same as the above?
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
*it /= 2.0;
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ std::vector<double> half(const std::vector<double>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
// would you believe this is the same as the above?
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
*it /= 2.0;
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ std::deque<float> half(const std::deque<float>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::deque<double>& v) {
|
void halve_in_place(std::deque<double>& v) {
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
for (std::deque<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
*it /= 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ double average(std::list<int> v) {
|
||||||
|
|
||||||
|
|
||||||
void halve_in_place(std::list<double>& v) {
|
void halve_in_place(std::list<double>& v) {
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
for (std::list<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
*it /= 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Struct {
|
struct Struct {
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ std::vector<Real> half(const std::vector<Real>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
*it /= 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Struct {
|
struct Struct {
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ std::vector<Real> half(const std::vector<Real>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void halve_in_place(std::vector<double>& v) {
|
void halve_in_place(std::vector<double>& v) {
|
||||||
std::transform(v.begin(),v.end(),v.begin(),
|
for (std::vector<double>::iterator it = v.begin(); it != v.end(); ++it)
|
||||||
std::bind2nd(std::divides<double>(),2.0));
|
*it /= 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue