From 3fa320a861670f2babc09a3a9f00526b47673716 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <jan.travnicek@.fit.cvut.cz>
Date: Tue, 28 May 2019 16:05:04 +0200
Subject: [PATCH] remove allocator fix

---
 alib2std/src/extensions/allocFix.hpp          | 55 -------------------
 alib2std/src/extensions/container/deque.hpp   |  3 +-
 .../src/extensions/container/forward_list.hpp |  1 -
 alib2std/src/extensions/container/list.hpp    |  3 +-
 alib2std/src/extensions/container/map.hpp     |  3 +-
 .../src/extensions/container/multimap.hpp     |  3 +-
 .../src/extensions/container/ptr_vector.hpp   |  1 -
 alib2std/src/extensions/container/set.hpp     |  3 +-
 .../extensions/container/unordered_map.hpp    |  3 +-
 alib2std/src/extensions/container/vector.hpp  |  3 +-
 10 files changed, 7 insertions(+), 71 deletions(-)
 delete mode 100644 alib2std/src/extensions/allocFix.hpp

diff --git a/alib2std/src/extensions/allocFix.hpp b/alib2std/src/extensions/allocFix.hpp
deleted file mode 100644
index 8ded1be515..0000000000
--- a/alib2std/src/extensions/allocFix.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * allocFix.hpp
- *
- * This file is part of Algorithms library toolkit.
- * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
-
- * Algorithms library toolkit is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
-
- * Algorithms library toolkit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with Algorithms library toolkit.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Created on: Mar 6, 2018
- * Author: Jan Travnicek
- */
-
-#ifndef __ALLOC_FIX_HPP_
-#define __ALLOC_FIX_HPP_
-
-// related to issue with 'undefined reference to allocator < ... >::allocator ( )', subject of a delete when g++ fixes the issue
-// the undefined reference occurs when one inherits from a class whose constructor has default value for the allocator
-// I guess the default parameter construction (allocator constructor) should be inlined but it isn't. Its code is not emited either.
-
-namespace ext {
-
-/**
- * \brief
- * Class implementing the fix of undefined allocator
- *
- * TODO test if later versions of g++ are no longer affected.
- */
-template < class Alloc >
-class AllocFix {
-public:
-	/**
-	 * \brief
-	 * Constructor to make sure the default constructor of given Allocator exists.
-	 */
-	AllocFix ( ) {
-		// just to make sure the allocator constructor exists
-		static Alloc alloc;
-		(void) alloc; // make unused variable warning go away
-	}
-};
-
-} /* namespace ext */
-
-#endif /* __ALLOC_FIX_HPP_ */
diff --git a/alib2std/src/extensions/container/deque.hpp b/alib2std/src/extensions/container/deque.hpp
index 25758c7d6c..4be95b0488 100644
--- a/alib2std/src/extensions/container/deque.hpp
+++ b/alib2std/src/extensions/container/deque.hpp
@@ -30,7 +30,6 @@
 #include <string>
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
@@ -45,7 +44,7 @@ namespace ext {
  * \tparam Alloc the allocator of values of type T
  */
 template < class T, class Alloc = std::allocator < T > >
-class deque : public std::deque < T, Alloc >, AllocFix < Alloc > {
+class deque : public std::deque < T, Alloc > {
 public:
 	/**
 	 * Inherit constructors of the standard deque
diff --git a/alib2std/src/extensions/container/forward_list.hpp b/alib2std/src/extensions/container/forward_list.hpp
index 2bec997090..4aeea8f147 100644
--- a/alib2std/src/extensions/container/forward_list.hpp
+++ b/alib2std/src/extensions/container/forward_list.hpp
@@ -30,7 +30,6 @@
 #include <string>
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
diff --git a/alib2std/src/extensions/container/list.hpp b/alib2std/src/extensions/container/list.hpp
index 0c2a04600b..56225afbd8 100644
--- a/alib2std/src/extensions/container/list.hpp
+++ b/alib2std/src/extensions/container/list.hpp
@@ -30,7 +30,6 @@
 #include <string>
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
@@ -45,7 +44,7 @@ namespace ext {
  * \tparam Alloc the allocator of values of type T
  */
 template < class T, class Alloc = std::allocator < T > >
-class list : public std::list < T, Alloc >, AllocFix < Alloc > {
+class list : public std::list < T, Alloc > {
 public:
 	/**
 	 * Inherit constructors of the standard list
diff --git a/alib2std/src/extensions/container/map.hpp b/alib2std/src/extensions/container/map.hpp
index 9ba8c3fd43..37d095dbfe 100644
--- a/alib2std/src/extensions/container/map.hpp
+++ b/alib2std/src/extensions/container/map.hpp
@@ -33,7 +33,6 @@
 #include "pair.hpp"
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
@@ -50,7 +49,7 @@ namespace ext {
  * \tparam Alloc the allocator of values of type T
  */
 template < typename T, typename R, typename Cmp = std::less < >, typename Alloc = std::allocator < std::pair < const T, R > > >
-class map : public std::map < T, R, Cmp, Alloc >, AllocFix < Alloc > {
+class map : public std::map < T, R, Cmp, Alloc > {
 public:
 	/**
 	 * Inherit constructors of the standard map
diff --git a/alib2std/src/extensions/container/multimap.hpp b/alib2std/src/extensions/container/multimap.hpp
index d999f53894..4cc99ccdb8 100644
--- a/alib2std/src/extensions/container/multimap.hpp
+++ b/alib2std/src/extensions/container/multimap.hpp
@@ -33,7 +33,6 @@
 #include "pair.hpp"
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
@@ -50,7 +49,7 @@ namespace ext {
  * \tparam Alloc the allocator of values of type T
  */
 template < typename T, typename R, typename Cmp = std::less < >, typename Alloc = std::allocator < std::pair < const T, R > > >
-class multimap : public std::multimap < T, R, Cmp, Alloc >, AllocFix < Alloc > {
+class multimap : public std::multimap < T, R, Cmp, Alloc > {
 public:
 	/**
 	 * Inherit constructors of the standard multimap
diff --git a/alib2std/src/extensions/container/ptr_vector.hpp b/alib2std/src/extensions/container/ptr_vector.hpp
index e8eb52d8c1..a898c7e075 100644
--- a/alib2std/src/extensions/container/ptr_vector.hpp
+++ b/alib2std/src/extensions/container/ptr_vector.hpp
@@ -29,7 +29,6 @@
 #include <string>
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 #include <extensions/clone.hpp>
 #include <extensions/container/vector.hpp>
diff --git a/alib2std/src/extensions/container/set.hpp b/alib2std/src/extensions/container/set.hpp
index bd7ace0b51..e2fb7803ce 100644
--- a/alib2std/src/extensions/container/set.hpp
+++ b/alib2std/src/extensions/container/set.hpp
@@ -30,7 +30,6 @@
 #include <string>
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
@@ -45,7 +44,7 @@ namespace ext {
  * \tparam Alloc the allocator of values of type T
  */
 template < typename T, typename Cmp = std::less < >, typename Alloc = std::allocator < T > >
-class set : public std::set < T, Cmp, Alloc >, AllocFix < Alloc > {
+class set : public std::set < T, Cmp, Alloc > {
 public:
 	/**
 	 * Inherit constructors of the standard set
diff --git a/alib2std/src/extensions/container/unordered_map.hpp b/alib2std/src/extensions/container/unordered_map.hpp
index a25d417981..96be42cbde 100644
--- a/alib2std/src/extensions/container/unordered_map.hpp
+++ b/alib2std/src/extensions/container/unordered_map.hpp
@@ -30,7 +30,6 @@
 #include <string>
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
@@ -48,7 +47,7 @@ namespace ext {
  * \tparam Alloc the allocator of values of type T
  */
 template < class T, class R, class Hash = std::hash < T >, class KeyEqual = std::equal_to < T >, class Alloc = std::allocator < std::pair < const T, R > > >
-class unordered_map : public std::unordered_map < T, R, Hash, KeyEqual, Alloc >, AllocFix < Alloc > {
+class unordered_map : public std::unordered_map < T, R, Hash, KeyEqual, Alloc > {
 public:
 	/**
 	 * Inherit constructors of the standard unordered_map
diff --git a/alib2std/src/extensions/container/vector.hpp b/alib2std/src/extensions/container/vector.hpp
index dbbad46166..8c2e28e883 100644
--- a/alib2std/src/extensions/container/vector.hpp
+++ b/alib2std/src/extensions/container/vector.hpp
@@ -31,7 +31,6 @@
 #include <iostream>
 
 #include <extensions/compare.hpp>
-#include <extensions/allocFix.hpp>
 #include <extensions/range.hpp>
 
 namespace ext {
@@ -46,7 +45,7 @@ namespace ext {
  * \tparam Alloc the allocator of values of type T
  */
 template < class T, class Alloc = std::allocator < T > >
-class vector : public std::vector < T, Alloc >, AllocFix < Alloc > {
+class vector : public std::vector < T, Alloc > {
 public:
 	/**
 	 * Inherit constructors of the standard vector
-- 
GitLab