Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace System;
- void SetLowerBoundsWrapper(array<double>^ lb)
- {
- int n = lb->Length;
- std::vector<double> lower(n); //create a std::vector
- for(int i = 0; i<n ; i++)
- {
- lower[i] = lb[i]; //copy element-wise
- }
- _opt->set_lower_bounds(lower);
- }
- #include <algorithm>
- #include <vector>
- void SetLowerBoundsWrapper(array<double>^ lb)
- {
- std::vector<double> lower(lb->Length);
- {
- pin_ptr<double> pin(&lb[0]);
- double *first(pin), *last(pin + lb->Length);
- std::copy(first, last, lower.begin());
- }
- _opt->set_lower_bounds(lower);
- }
- void SetLowerBoundsWrapper2(array<double>^ lb)
- {
- std::vector<double> lower(lb->Length);
- {
- pin_ptr<double> pin(&lb[0]);
- std::copy(
- static_cast<double*>(pin),
- static_cast<double*>(pin + lb->Length),
- lower.begin()
- );
- }
- _opt->set_lower_bounds(lower);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement