Merge pull request #374 from lioncash/noexcept

gl_resource_manager: Add missing noexcept specifiers to move constructors and assignment operators
This commit is contained in:
bunnei 2018-04-20 22:28:47 -04:00 committed by GitHub
commit 634d9ee18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,13 +14,13 @@ class OGLTexture : private NonCopyable {
public: public:
OGLTexture() = default; OGLTexture() = default;
OGLTexture(OGLTexture&& o) : handle(std::exchange(o.handle, 0)) {} OGLTexture(OGLTexture&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
~OGLTexture() { ~OGLTexture() {
Release(); Release();
} }
OGLTexture& operator=(OGLTexture&& o) { OGLTexture& operator=(OGLTexture&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, 0); handle = std::exchange(o.handle, 0);
return *this; return *this;
@ -49,13 +49,13 @@ class OGLSampler : private NonCopyable {
public: public:
OGLSampler() = default; OGLSampler() = default;
OGLSampler(OGLSampler&& o) : handle(std::exchange(o.handle, 0)) {} OGLSampler(OGLSampler&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
~OGLSampler() { ~OGLSampler() {
Release(); Release();
} }
OGLSampler& operator=(OGLSampler&& o) { OGLSampler& operator=(OGLSampler&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, 0); handle = std::exchange(o.handle, 0);
return *this; return *this;
@ -84,13 +84,13 @@ class OGLShader : private NonCopyable {
public: public:
OGLShader() = default; OGLShader() = default;
OGLShader(OGLShader&& o) : handle(std::exchange(o.handle, 0)) {} OGLShader(OGLShader&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
~OGLShader() { ~OGLShader() {
Release(); Release();
} }
OGLShader& operator=(OGLShader&& o) { OGLShader& operator=(OGLShader&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, 0); handle = std::exchange(o.handle, 0);
return *this; return *this;
@ -118,13 +118,13 @@ class OGLProgram : private NonCopyable {
public: public:
OGLProgram() = default; OGLProgram() = default;
OGLProgram(OGLProgram&& o) : handle(std::exchange(o.handle, 0)) {} OGLProgram(OGLProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
~OGLProgram() { ~OGLProgram() {
Release(); Release();
} }
OGLProgram& operator=(OGLProgram&& o) { OGLProgram& operator=(OGLProgram&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, 0); handle = std::exchange(o.handle, 0);
return *this; return *this;
@ -165,13 +165,12 @@ 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 {
handle = std::exchange<GLuint>(o.handle, 0); handle = std::exchange<GLuint>(o.handle, 0);
return *this; return *this;
} }
@ -199,13 +198,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;
@ -234,12 +233,12 @@ class OGLSync : private NonCopyable {
public: public:
OGLSync() = default; OGLSync() = default;
OGLSync(OGLSync&& o) : handle(std::exchange(o.handle, nullptr)) {} OGLSync(OGLSync&& o) noexcept : handle(std::exchange(o.handle, nullptr)) {}
~OGLSync() { ~OGLSync() {
Release(); Release();
} }
OGLSync& operator=(OGLSync&& o) { OGLSync& operator=(OGLSync&& o) noexcept {
Release(); Release();
handle = std::exchange(o.handle, nullptr); handle = std::exchange(o.handle, nullptr);
return *this; return *this;
@ -267,13 +266,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;
@ -302,13 +301,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;