From 37b63d73f408509a6a9a3ca2a24d46a07922e5d9 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Thu, 21 Jun 2018 20:09:06 +0200
Subject: [PATCH] simplify wrappers of std containers

---
 alib2std/src/extensions/array.hpp         |  3 +--
 alib2std/src/extensions/bitset.hpp        |  3 +--
 alib2std/src/extensions/forward_list.hpp  | 26 ++++++-----------------
 alib2std/src/extensions/list.hpp          |  3 +--
 alib2std/src/extensions/map.hpp           |  3 +--
 alib2std/src/extensions/set.hpp           |  3 +--
 alib2std/src/extensions/string.hpp        |  3 +--
 alib2std/src/extensions/tuple.hpp         |  3 +--
 alib2std/src/extensions/unordered_map.hpp |  3 +--
 alib2std/src/extensions/vector.hpp        |  3 +--
 10 files changed, 15 insertions(+), 38 deletions(-)

diff --git a/alib2std/src/extensions/array.hpp b/alib2std/src/extensions/array.hpp
index 4220df88f2..f582152962 100644
--- a/alib2std/src/extensions/array.hpp
+++ b/alib2std/src/extensions/array.hpp
@@ -61,8 +61,7 @@ public:
 	/**
 	 * Default constructor needed by g++ since it is not inherited
 	 */
-	array ( ) noexcept : std::array < T, N > ( ) {
-	}
+	array ( ) = default;
 
 	/**
 	 * Copy constructor needed by g++ since it is not inherited
diff --git a/alib2std/src/extensions/bitset.hpp b/alib2std/src/extensions/bitset.hpp
index df779e177d..41083254da 100644
--- a/alib2std/src/extensions/bitset.hpp
+++ b/alib2std/src/extensions/bitset.hpp
@@ -57,8 +57,7 @@ public:
 	/**
 	 * Default constructor needed by g++ since it is not inherited
 	 */
-	bitset ( ) noexcept : std::bitset < N > ( ) {
-	}
+	bitset ( ) = default;
 
 	/**
 	 * Copy constructor needed by g++ since it is not inherited
diff --git a/alib2std/src/extensions/forward_list.hpp b/alib2std/src/extensions/forward_list.hpp
index 70c10f3f14..19aad2fbbb 100644
--- a/alib2std/src/extensions/forward_list.hpp
+++ b/alib2std/src/extensions/forward_list.hpp
@@ -21,32 +21,18 @@ namespace ext {
 template < class T, class Alloc = std::allocator < T > >
 class forward_list : public std::forward_list < T, Alloc >, AllocFix < Alloc > {
 public:
-#ifdef __clang__
 	using std::forward_list < T, Alloc >::forward_list;
 	using std::forward_list < T, Alloc >::operator =;
-#else
-	forward_list ( ) noexcept : std::forward_list < T, Alloc > ( ) {
-	}
+#ifndef __clang__
+	forward_list ( ) = default;
 
-	forward_list ( const forward_list & other ) noexcept : std::forward_list < T, Alloc > ( other ) {
-	}
+	forward_list ( const forward_list & other ) = default;
 
-	forward_list ( forward_list && other ) noexcept : std::forward_list < T, Alloc > ( std::move ( other ) ) {
-	}
+	forward_list ( forward_list && other ) = default;
 
-	using std::forward_list < T, Alloc >::forward_list;
+	forward_list & operator = ( forward_list && other ) = default;
 
-	forward_list & operator = ( forward_list && other ) noexcept {
-		static_cast < std::forward_list < T, Alloc > & > ( * this ) = std::move ( other );
-		return * this;
-	}
-
-	forward_list & operator = ( const forward_list & other ) noexcept {
-		static_cast < std::forward_list < T, Alloc > & > ( * this ) = other;
-		return * this;
-	}
-
-	using std::forward_list < T, Alloc >::operator =;
+	forward_list & operator = ( const forward_list & other ) = default;
 #endif
 };
 
diff --git a/alib2std/src/extensions/list.hpp b/alib2std/src/extensions/list.hpp
index 9b26e78dc2..b7bfe9f633 100644
--- a/alib2std/src/extensions/list.hpp
+++ b/alib2std/src/extensions/list.hpp
@@ -24,8 +24,7 @@ public:
 	using std::list < T, Alloc >::list;
 	using std::list < T, Alloc >::operator =;
 #ifndef __clang__
-	list ( ) noexcept : std::list < T, Alloc > ( ) {
-	}
+	list ( ) = default;
 
 	list ( const list & other ) = default;
 
diff --git a/alib2std/src/extensions/map.hpp b/alib2std/src/extensions/map.hpp
index 10111ccfc8..20b09bf436 100644
--- a/alib2std/src/extensions/map.hpp
+++ b/alib2std/src/extensions/map.hpp
@@ -26,8 +26,7 @@ public:
 	using std::map< T, R, Cmp, Alloc >::map;
 	using std::map< T, R, Cmp, Alloc >::operator =;
 #ifndef __clang__
-	map ( ) noexcept : std::map < T, R, Cmp, Alloc > ( ) {
-	}
+	map ( ) = default;
 
 	map ( const map & other ) = default;
 
diff --git a/alib2std/src/extensions/set.hpp b/alib2std/src/extensions/set.hpp
index 05db6959c5..e7bedf486f 100644
--- a/alib2std/src/extensions/set.hpp
+++ b/alib2std/src/extensions/set.hpp
@@ -24,8 +24,7 @@ public:
 	using std::set < T, Cmp, Alloc >::set;
 	using std::set < T, Cmp, Alloc >::operator =;
 #ifndef __clang__
-	set ( ) noexcept : std::set < T, Cmp, Alloc > ( ) {
-	}
+	set ( ) = default;
 
 	set ( const set & other ) = default;
 
diff --git a/alib2std/src/extensions/string.hpp b/alib2std/src/extensions/string.hpp
index 2c35a54aa9..fba695ccdf 100644
--- a/alib2std/src/extensions/string.hpp
+++ b/alib2std/src/extensions/string.hpp
@@ -22,8 +22,7 @@ public:
 	using std::string::string;
 	using std::string::operator =;
 #ifndef __clang__
-	string ( ) noexcept : std::string ( ) {
-	}
+	string ( ) = default;
 
 	string ( const string & other ) = default;
 
diff --git a/alib2std/src/extensions/tuple.hpp b/alib2std/src/extensions/tuple.hpp
index 8c5b6c90ea..1e30ced360 100644
--- a/alib2std/src/extensions/tuple.hpp
+++ b/alib2std/src/extensions/tuple.hpp
@@ -23,8 +23,7 @@ public:
 	using std::tuple< Ts ... >::tuple;
 	using std::tuple< Ts ... >::operator =;
 #ifndef __clang__
-	tuple ( ) noexcept : std::tuple < Ts ... > ( ) {
-	}
+	tuple ( ) = default;
 
 	tuple ( const tuple & other ) = default;
 
diff --git a/alib2std/src/extensions/unordered_map.hpp b/alib2std/src/extensions/unordered_map.hpp
index 56de1dfb5a..3a433e672b 100644
--- a/alib2std/src/extensions/unordered_map.hpp
+++ b/alib2std/src/extensions/unordered_map.hpp
@@ -24,8 +24,7 @@ public:
 	using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::unordered_map;
 	using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::operator =;
 #ifndef __clang__
-	unordered_map ( ) noexcept : std::unordered_map < T, R, Hash, KeyEqual, Alloc > ( ) {
-	}
+	unordered_map ( ) = default;
 
 	unordered_map ( const unordered_map & other ) = default;
 
diff --git a/alib2std/src/extensions/vector.hpp b/alib2std/src/extensions/vector.hpp
index 63b24e3aff..1920b29b38 100644
--- a/alib2std/src/extensions/vector.hpp
+++ b/alib2std/src/extensions/vector.hpp
@@ -26,8 +26,7 @@ public:
 	using std::vector< T, Alloc >::vector;
 	using std::vector< T, Alloc >::operator =;
 #ifndef __clang__
-	vector ( ) noexcept : std::vector < T, Alloc > ( ) {
-	}
+	vector ( ) = default;
 
 	vector ( const vector & other ) = default;
 
-- 
GitLab