Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ improvements #294

Merged
merged 9 commits into from
May 15, 2019
Merged

C++ improvements #294

merged 9 commits into from
May 15, 2019

Conversation

bluescarni
Copy link
Member

@bluescarni bluescarni commented May 15, 2019

This PR adds a couple of capabilities on the C++ side:

  • generic assignment of a UDP/UDA/... to a problem/algorithm/..., so that now it is possible to write:
problem p;
p = rosenbrock{};
  • a new function is_valid() for user-defined classes, with which it is possible to query if the object was moved from:
problem p;
assert(p.is_valid());
problem p2 = std::move(p);
assert(!p.is_valid());

We already stated in the documentation that moved-from objects could only be destroyed and assigned to (revived). Now it is also possible to call is_valid() to query the current state of the object.

None of these features are meaningful in Python, so pygmo was not touched by these additions.

I also moved null_problem and null_algorithm to their own headers (they previously resided in problem.hpp and algorithm.hpp), and made some other smaller internal changes.

@bluescarni bluescarni requested a review from darioizzo May 15, 2019 08:21
@darioizzo
Copy link
Member

Looks good to me... happy about the null prob algo move !!

@darioizzo darioizzo merged commit 5b0b8f7 into esa:master May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants