瀏覽代碼

Add noexcept specifiers on move functions

Michael Ragazzon 3 年之前
父節點
當前提交
e407e9960f

+ 3 - 3
Include/RmlUi/Core/Containers/chobo/flat_map.hpp

@@ -162,7 +162,7 @@ public:
     {}
     {}
 
 
     flat_map(const flat_map& x) = default;
     flat_map(const flat_map& x) = default;
-    flat_map(flat_map&& x) = default;
+    flat_map(flat_map&& x) noexcept = default;
 
 
     flat_map(std::initializer_list<value_type> ilist) : pair_compare_t(Compare())
     flat_map(std::initializer_list<value_type> ilist) : pair_compare_t(Compare())
     {
     {
@@ -177,7 +177,7 @@ public:
         m_container = x.m_container;
         m_container = x.m_container;
         return *this;
         return *this;
     }
     }
-    flat_map& operator=(flat_map&& x)
+    flat_map& operator=(flat_map&& x) noexcept
     {
     {
         get_cmp() = std::move(x.get_cmp());
         get_cmp() = std::move(x.get_cmp());
         m_container = std::move(x.m_container);
         m_container = std::move(x.m_container);
@@ -330,7 +330,7 @@ public:
         return i->second;
         return i->second;
     }
     }
 
 
-    void swap(flat_map& x)
+    void swap(flat_map& x) noexcept
     {
     {
         std::swap(get_cmp(), x.get_cmp());
         std::swap(get_cmp(), x.get_cmp());
         m_container.swap(x.m_container);
         m_container.swap(x.m_container);

+ 2 - 2
Include/RmlUi/Core/Containers/chobo/flat_set.hpp

@@ -138,7 +138,7 @@ public:
     {}
     {}
 
 
     flat_set(const flat_set& x) = default;
     flat_set(const flat_set& x) = default;
-    flat_set(flat_set&& x) = default;
+    flat_set(flat_set&& x) noexcept = default;
 
 
 
 
     flat_set(std::initializer_list<value_type> ilist)
     flat_set(std::initializer_list<value_type> ilist)
@@ -259,7 +259,7 @@ public:
         return 1;
         return 1;
     }
     }
 
 
-    void swap(flat_set& x)
+    void swap(flat_set& x) noexcept
     {
     {
         std::swap(get_cmp(), x.get_cmp());
         std::swap(get_cmp(), x.get_cmp());
         m_container.swap(x.m_container);
         m_container.swap(x.m_container);

+ 3 - 3
Include/RmlUi/Core/Geometry.h

@@ -56,8 +56,8 @@ public:
 	Geometry(const Geometry&) = delete;
 	Geometry(const Geometry&) = delete;
 	Geometry& operator=(const Geometry&) = delete;
 	Geometry& operator=(const Geometry&) = delete;
 
 
-	Geometry(Geometry&& other);
-	Geometry& operator=(Geometry&& other);
+	Geometry(Geometry&& other) noexcept;
+	Geometry& operator=(Geometry&& other) noexcept;
 
 
 	~Geometry();
 	~Geometry();
 
 
@@ -91,7 +91,7 @@ public:
 
 
 private:
 private:
 	// Move members from another geometry.
 	// Move members from another geometry.
-	void MoveFrom(Geometry& other);
+	void MoveFrom(Geometry& other) noexcept;
 
 
 	// Returns the host context's render interface.
 	// Returns the host context's render interface.
 	RenderInterface* GetRenderInterface();
 	RenderInterface* GetRenderInterface();

+ 1 - 1
Include/RmlUi/Core/StyleSheetTypes.h

@@ -97,7 +97,7 @@ namespace std {
 // Hash specialization for the node list, so it can be used as key in UnorderedMap.
 // Hash specialization for the node list, so it can be used as key in UnorderedMap.
 template <>
 template <>
 struct hash<::Rml::StyleSheetIndex::NodeList> {
 struct hash<::Rml::StyleSheetIndex::NodeList> {
-	std::size_t operator()(const ::Rml::StyleSheetIndex::NodeList& nodes) const
+	std::size_t operator()(const ::Rml::StyleSheetIndex::NodeList& nodes) const noexcept
 	{
 	{
 		std::size_t seed = 0;
 		std::size_t seed = 0;
 		for (const ::Rml::StyleSheetNode* node : nodes)
 		for (const ::Rml::StyleSheetNode* node : nodes)

+ 3 - 3
Source/Core/Geometry.cpp

@@ -48,20 +48,20 @@ Geometry::Geometry(Context* host_context) : host_context(host_context)
 	database_handle = GeometryDatabase::Insert(this);
 	database_handle = GeometryDatabase::Insert(this);
 }
 }
 
 
-Geometry::Geometry(Geometry&& other)
+Geometry::Geometry(Geometry&& other) noexcept
 {
 {
 	MoveFrom(other);
 	MoveFrom(other);
 	database_handle = GeometryDatabase::Insert(this);
 	database_handle = GeometryDatabase::Insert(this);
 }
 }
 
 
-Geometry& Geometry::operator=(Geometry&& other)
+Geometry& Geometry::operator=(Geometry&& other) noexcept
 {
 {
 	MoveFrom(other);
 	MoveFrom(other);
 	// Keep the database handles from construction unchanged, they are tied to the *this* pointer and should not change.
 	// Keep the database handles from construction unchanged, they are tied to the *this* pointer and should not change.
 	return *this;
 	return *this;
 }
 }
 
 
-void Geometry::MoveFrom(Geometry& other)
+void Geometry::MoveFrom(Geometry& other) noexcept
 {
 {
 	host_context = std::exchange(other.host_context, nullptr);
 	host_context = std::exchange(other.host_context, nullptr);
 	host_element = std::exchange(other.host_element, nullptr);
 	host_element = std::exchange(other.host_element, nullptr);