gl_resource_manager: Make use of noexcept on move constructors and move assignment operators (#5340)

Some of the classes in this file already do this, so we can apply this
to the other ones to be consistent.

Allows these classes to play nicely and not churn copies when used with
standard containers or any other API that makes use of
std::move_if_noexcept.
This commit is contained in:
LC 2020-06-23 12:00:25 -04:00 committed by GitHub
parent 7444c95132
commit e79de3107e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,13 +141,13 @@ public:
class OGLPipeline : private NonCopyable { class OGLPipeline : private NonCopyable {
public: public:
OGLPipeline() = default; OGLPipeline() = default;
OGLPipeline(OGLPipeline&& o) { OGLPipeline(OGLPipeline&& o) noexcept {
handle = std::exchange<GLuint>(o.handle, 0); handle = std::exchange<GLuint>(o.handle, 0);
} }
~OGLPipeline() { ~OGLPipeline() {
Release(); Release();
} }
OGLPipeline& operator=(OGLPipeline&& o) { OGLPipeline& operator=(OGLPipeline&& o) noexcept {
Release(); Release();
handle = std::exchange<GLuint>(o.handle, 0); handle = std::exchange<GLuint>(o.handle, 0);
return *this; return *this;
@ -166,13 +166,13 @@ class OGLBuffer : private NonCopyable {
public: public:
OGLBuffer() = default; OGLBuffer() = default;
OGLBuffer(OGLBuffer&& o) : handle(std::exchange(o.handle, 0)) {} OGLBuffer(OGLBuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
~OGLBuffer() { ~OGLBuffer() {
Release(); Release();
} }
OGLBuffer& operator=(OGLBuffer&& o) { OGLBuffer& operator=(OGLBuffer&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, 0); handle = std::exchange(o.handle, 0);
return *this; return *this;
@ -191,13 +191,13 @@ class OGLVertexArray : private NonCopyable {
public: public:
OGLVertexArray() = default; OGLVertexArray() = default;
OGLVertexArray(OGLVertexArray&& o) : handle(std::exchange(o.handle, 0)) {} OGLVertexArray(OGLVertexArray&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
~OGLVertexArray() { ~OGLVertexArray() {
Release(); Release();
} }
OGLVertexArray& operator=(OGLVertexArray&& o) { OGLVertexArray& operator=(OGLVertexArray&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, 0); handle = std::exchange(o.handle, 0);
return *this; return *this;
@ -216,13 +216,13 @@ class OGLFramebuffer : private NonCopyable {
public: public:
OGLFramebuffer() = default; OGLFramebuffer() = default;
OGLFramebuffer(OGLFramebuffer&& o) : handle(std::exchange(o.handle, 0)) {} OGLFramebuffer(OGLFramebuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
~OGLFramebuffer() { ~OGLFramebuffer() {
Release(); Release();
} }
OGLFramebuffer& operator=(OGLFramebuffer&& o) { OGLFramebuffer& operator=(OGLFramebuffer&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, 0); handle = std::exchange(o.handle, 0);
return *this; return *this;