Added move constructor and move assignment operator for sf::Shader
- [x] Has this change been discussed on the forum or in an issue before? Yes, multiple times in multiple topics
- [x] Does the code follow the SFML Code Style Guide?
- [x] Have you provided some example/test code for your changes? See related issue
Related to >=C++11 change It's a syntactic change that should not break any cross-platform compatibility. The compatibility is related to the compiler and not the platform, and today most if not all modern compilers support C++11. But it can break C++03 code (any project use it?... if yes, they probably also use older versions of SFML that are also compatible with C++03).
Some tests did not pass because they aren't actually... C++11 compatible.
It's can also maybe be a change for another branch forecasting C++11.
Description
Make sf::Shader moveable, and keep not copiable.
This PR is related to the issue https://github.com/SFML/SFML/issues/1675 Code from the issue:
#include <SFML/Graphics.hpp>
sf::Shader loadShader() {
sf::Shader shader;
/* Probably more code here */
return shader;
}
int main() {
sf::Shader myShader = loadShader();
}
Valid points. There are different ways to implement move semantics in C++, we should agree on one.
I brought this up in the forum a while ago, see here and subsequent posts.
There are different ways to implement move semantics in C++, we should agree on one.
I think it is important to keep a strong exception guarantee for move semantics. The transfer should always be intuitive, and I believe that noexcept grants this intuitiveness. I also posted my view on the forum thread you mentioned.
superseded by #2277 ?
Yep ^