From 3b5c174d3ff496a24e44209efb97883b7164db2f Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 20 Jun 2018 16:35:47 +0200 Subject: [PATCH] simplify definition of inherited constructors and operators = in container extensions --- alib2std/src/extensions/bitset.hpp | 7 +------ alib2std/src/extensions/deque.hpp | 7 +------ alib2std/src/extensions/list.hpp | 7 +------ alib2std/src/extensions/map.hpp | 7 +------ alib2std/src/extensions/pair.hpp | 7 +------ alib2std/src/extensions/set.hpp | 7 +------ alib2std/src/extensions/string.hpp | 7 +------ alib2std/src/extensions/tuple.hpp | 7 +------ alib2std/src/extensions/unordered_map.hpp | 7 +------ alib2std/src/extensions/vector.hpp | 7 +------ 10 files changed, 10 insertions(+), 60 deletions(-) diff --git a/alib2std/src/extensions/bitset.hpp b/alib2std/src/extensions/bitset.hpp index de7cbb7a20..3aba954f8b 100644 --- a/alib2std/src/extensions/bitset.hpp +++ b/alib2std/src/extensions/bitset.hpp @@ -20,10 +20,9 @@ namespace ext { template < std::size_t N > class bitset : public std::bitset < N > { public: -#ifdef __clang__ using std::bitset < N >::bitset; using std::bitset < N >::operator =; -#else +#ifndef __clang__ bitset ( ) noexcept : std::bitset < N > ( ) { } @@ -31,13 +30,9 @@ public: bitset ( bitset && other ) = default; - using std::bitset < N >::bitset; - bitset & operator = ( bitset && other ) = default; bitset & operator = ( const bitset & other ) = default; - - using std::bitset < N >::operator =; #endif }; diff --git a/alib2std/src/extensions/deque.hpp b/alib2std/src/extensions/deque.hpp index a705f21e41..db616ac78d 100644 --- a/alib2std/src/extensions/deque.hpp +++ b/alib2std/src/extensions/deque.hpp @@ -21,10 +21,9 @@ namespace ext { template < class T, class Alloc = std::allocator < T > > class deque : public std::deque < T, Alloc >, AllocFix < Alloc > { public: -#ifdef __clang__ using std::deque < T, Alloc >::deque; using std::deque < T, Alloc >::operator =; -#else +#ifndef __clang__ deque ( ) noexcept : std::deque < T, Alloc > ( ) { } @@ -32,13 +31,9 @@ public: deque ( deque && other ) = default; - using std::deque < T, Alloc >::deque; - deque & operator = ( deque && other ) = default; deque & operator = ( const deque & other ) = default; - - using std::deque < T, Alloc >::operator =; #endif }; diff --git a/alib2std/src/extensions/list.hpp b/alib2std/src/extensions/list.hpp index c97d514cec..9b26e78dc2 100644 --- a/alib2std/src/extensions/list.hpp +++ b/alib2std/src/extensions/list.hpp @@ -21,10 +21,9 @@ namespace ext { template < class T, class Alloc = std::allocator < T > > class list : public std::list < T, Alloc >, AllocFix < Alloc > { public: -#ifdef __clang__ using std::list < T, Alloc >::list; using std::list < T, Alloc >::operator =; -#else +#ifndef __clang__ list ( ) noexcept : std::list < T, Alloc > ( ) { } @@ -32,13 +31,9 @@ public: list ( list && other ) = default; - using std::list < T, Alloc >::list; - list & operator = ( list && other ) = default; list & operator = ( const list & other ) = default; - - using std::list < T, Alloc >::operator =; #endif }; diff --git a/alib2std/src/extensions/map.hpp b/alib2std/src/extensions/map.hpp index e0b905e4a7..10111ccfc8 100644 --- a/alib2std/src/extensions/map.hpp +++ b/alib2std/src/extensions/map.hpp @@ -23,10 +23,9 @@ namespace ext { 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 > { public: -#ifdef __clang__ using std::map< T, R, Cmp, Alloc >::map; using std::map< T, R, Cmp, Alloc >::operator =; -#else +#ifndef __clang__ map ( ) noexcept : std::map < T, R, Cmp, Alloc > ( ) { } @@ -34,13 +33,9 @@ public: map ( map && other ) = default; - using std::map < T, R, Cmp, Alloc >::map; - map & operator = ( map && other ) = default; map & operator = ( const map & other ) = default; - - using std::map < T, R, Cmp, Alloc >::operator =; #endif using iterator = typename std::map<T, R, Cmp, Alloc>::iterator; using key_type = typename std::map<T, R, Cmp, Alloc>::key_type; diff --git a/alib2std/src/extensions/pair.hpp b/alib2std/src/extensions/pair.hpp index fd4b992e52..9d0144e471 100644 --- a/alib2std/src/extensions/pair.hpp +++ b/alib2std/src/extensions/pair.hpp @@ -20,21 +20,16 @@ namespace ext { template < class T, class R > class pair : public std::pair < T, R > { public: -#ifdef __clang__ using std::pair < T, R >::pair; using std::pair < T, R >::operator =; -#else +#ifndef __clang__ pair ( const pair & other ) = default; pair ( pair && other ) = default; - using std::pair < T, R >::pair; - pair & operator = ( pair && other ) = default; pair & operator = ( const pair & other ) = default; - - using std::pair < T, R >::operator =; #endif }; diff --git a/alib2std/src/extensions/set.hpp b/alib2std/src/extensions/set.hpp index 7ed0e02ebb..05db6959c5 100644 --- a/alib2std/src/extensions/set.hpp +++ b/alib2std/src/extensions/set.hpp @@ -21,10 +21,9 @@ namespace ext { template < typename T, typename Cmp = std::less < >, typename Alloc = std::allocator < T > > class set : public std::set < T, Cmp, Alloc >, AllocFix < Alloc > { public: -#ifdef __clang__ using std::set < T, Cmp, Alloc >::set; using std::set < T, Cmp, Alloc >::operator =; -#else +#ifndef __clang__ set ( ) noexcept : std::set < T, Cmp, Alloc > ( ) { } @@ -32,13 +31,9 @@ public: set ( set && other ) = default; - using std::set < T, Cmp, Alloc >::set; - set & operator = ( set && other ) = default; set & operator = ( const set & other ) = default; - - using std::set < T, Cmp, Alloc >::operator =; #endif }; diff --git a/alib2std/src/extensions/string.hpp b/alib2std/src/extensions/string.hpp index bb82632786..2c35a54aa9 100644 --- a/alib2std/src/extensions/string.hpp +++ b/alib2std/src/extensions/string.hpp @@ -19,10 +19,9 @@ namespace ext { class string : public std::string { public: -#ifdef __clang__ using std::string::string; using std::string::operator =; -#else +#ifndef __clang__ string ( ) noexcept : std::string ( ) { } @@ -30,13 +29,9 @@ public: string ( string && other ) = default; - using std::string::string; - string & operator = ( string && other ) = default; string & operator = ( const string & other ) = default; - - using std::string::operator =; #endif string ( const std::string & other ) noexcept : std::string ( other ) { } diff --git a/alib2std/src/extensions/tuple.hpp b/alib2std/src/extensions/tuple.hpp index dd3d748666..8c5b6c90ea 100644 --- a/alib2std/src/extensions/tuple.hpp +++ b/alib2std/src/extensions/tuple.hpp @@ -20,10 +20,9 @@ namespace ext { template < typename ... Ts > class tuple : public std::tuple < Ts ... > { public: -#ifdef __clang__ using std::tuple< Ts ... >::tuple; using std::tuple< Ts ... >::operator =; -#else +#ifndef __clang__ tuple ( ) noexcept : std::tuple < Ts ... > ( ) { } @@ -31,13 +30,9 @@ public: tuple ( tuple && other ) = default; - using std::tuple < Ts ... >::tuple; - tuple & operator = ( tuple && other ) = default; tuple & operator = ( const tuple & other ) = default; - - using std::tuple < Ts ... >::operator =; #endif }; diff --git a/alib2std/src/extensions/unordered_map.hpp b/alib2std/src/extensions/unordered_map.hpp index 6d55d72fef..56de1dfb5a 100644 --- a/alib2std/src/extensions/unordered_map.hpp +++ b/alib2std/src/extensions/unordered_map.hpp @@ -21,10 +21,9 @@ namespace ext { 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 > { public: -#ifdef __clang__ using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::unordered_map; using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::operator =; -#else +#ifndef __clang__ unordered_map ( ) noexcept : std::unordered_map < T, R, Hash, KeyEqual, Alloc > ( ) { } @@ -32,13 +31,9 @@ public: unordered_map ( unordered_map && other ) = default; - using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::unordered_map; - unordered_map & operator = ( unordered_map && other ) = default; unordered_map & operator = ( const unordered_map & other ) = default; - - using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::operator =; #endif }; diff --git a/alib2std/src/extensions/vector.hpp b/alib2std/src/extensions/vector.hpp index 4b9ff7207c..63b24e3aff 100644 --- a/alib2std/src/extensions/vector.hpp +++ b/alib2std/src/extensions/vector.hpp @@ -23,10 +23,9 @@ namespace ext { template < class T, class Alloc = std::allocator < T > > class vector : public std::vector < T, Alloc >, AllocFix < Alloc > { public: -#ifdef __clang__ using std::vector< T, Alloc >::vector; using std::vector< T, Alloc >::operator =; -#else +#ifndef __clang__ vector ( ) noexcept : std::vector < T, Alloc > ( ) { } @@ -34,13 +33,9 @@ public: vector ( vector && other ) = default; - using std::vector < T, Alloc >::vector; - vector & operator = ( vector && other ) = default; vector & operator = ( const vector & other ) = default; - - using std::vector < T, Alloc >::operator =; #endif }; -- GitLab