Skip to content
Snippets Groups Projects
Commit 3b5c174d authored by Jan Trávníček's avatar Jan Trávníček
Browse files

simplify definition of inherited constructors and operators = in

container extensions
parent 91e63687
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -20,10 +20,9 @@ namespace ext { ...@@ -20,10 +20,9 @@ namespace ext {
template < std::size_t N > template < std::size_t N >
class bitset : public std::bitset < N > { class bitset : public std::bitset < N > {
public: public:
#ifdef __clang__
using std::bitset < N >::bitset; using std::bitset < N >::bitset;
using std::bitset < N >::operator =; using std::bitset < N >::operator =;
#else #ifndef __clang__
bitset ( ) noexcept : std::bitset < N > ( ) { bitset ( ) noexcept : std::bitset < N > ( ) {
} }
   
...@@ -31,13 +30,9 @@ public: ...@@ -31,13 +30,9 @@ public:
   
bitset ( bitset && other ) = default; bitset ( bitset && other ) = default;
   
using std::bitset < N >::bitset;
bitset & operator = ( bitset && other ) = default; bitset & operator = ( bitset && other ) = default;
   
bitset & operator = ( const bitset & other ) = default; bitset & operator = ( const bitset & other ) = default;
using std::bitset < N >::operator =;
#endif #endif
}; };
   
......
...@@ -21,10 +21,9 @@ namespace ext { ...@@ -21,10 +21,9 @@ namespace ext {
template < class T, class Alloc = std::allocator < 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 >, AllocFix < Alloc > {
public: public:
#ifdef __clang__
using std::deque < T, Alloc >::deque; using std::deque < T, Alloc >::deque;
using std::deque < T, Alloc >::operator =; using std::deque < T, Alloc >::operator =;
#else #ifndef __clang__
deque ( ) noexcept : std::deque < T, Alloc > ( ) { deque ( ) noexcept : std::deque < T, Alloc > ( ) {
} }
   
...@@ -32,13 +31,9 @@ public: ...@@ -32,13 +31,9 @@ public:
   
deque ( deque && other ) = default; deque ( deque && other ) = default;
   
using std::deque < T, Alloc >::deque;
deque & operator = ( deque && other ) = default; deque & operator = ( deque && other ) = default;
   
deque & operator = ( const deque & other ) = default; deque & operator = ( const deque & other ) = default;
using std::deque < T, Alloc >::operator =;
#endif #endif
}; };
   
......
...@@ -21,10 +21,9 @@ namespace ext { ...@@ -21,10 +21,9 @@ namespace ext {
template < class T, class Alloc = std::allocator < 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 >, AllocFix < Alloc > {
public: public:
#ifdef __clang__
using std::list < T, Alloc >::list; using std::list < T, Alloc >::list;
using std::list < T, Alloc >::operator =; using std::list < T, Alloc >::operator =;
#else #ifndef __clang__
list ( ) noexcept : std::list < T, Alloc > ( ) { list ( ) noexcept : std::list < T, Alloc > ( ) {
} }
   
...@@ -32,13 +31,9 @@ public: ...@@ -32,13 +31,9 @@ public:
   
list ( list && other ) = default; list ( list && other ) = default;
   
using std::list < T, Alloc >::list;
list & operator = ( list && other ) = default; list & operator = ( list && other ) = default;
   
list & operator = ( const list & other ) = default; list & operator = ( const list & other ) = default;
using std::list < T, Alloc >::operator =;
#endif #endif
}; };
   
......
...@@ -23,10 +23,9 @@ namespace ext { ...@@ -23,10 +23,9 @@ namespace ext {
template < typename T, typename R, typename Cmp = std::less < >, typename Alloc = std::allocator < std::pair < const T, R > > > 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 >, AllocFix < Alloc > {
public: public:
#ifdef __clang__
using std::map< T, R, Cmp, Alloc >::map; using std::map< T, R, Cmp, Alloc >::map;
using std::map< T, R, Cmp, Alloc >::operator =; using std::map< T, R, Cmp, Alloc >::operator =;
#else #ifndef __clang__
map ( ) noexcept : std::map < T, R, Cmp, Alloc > ( ) { map ( ) noexcept : std::map < T, R, Cmp, Alloc > ( ) {
} }
   
...@@ -34,13 +33,9 @@ public: ...@@ -34,13 +33,9 @@ public:
   
map ( map && other ) = default; map ( map && other ) = default;
   
using std::map < T, R, Cmp, Alloc >::map;
map & operator = ( map && other ) = default; map & operator = ( map && other ) = default;
   
map & operator = ( const map & other ) = default; map & operator = ( const map & other ) = default;
using std::map < T, R, Cmp, Alloc >::operator =;
#endif #endif
using iterator = typename std::map<T, R, Cmp, Alloc>::iterator; using iterator = typename std::map<T, R, Cmp, Alloc>::iterator;
using key_type = typename std::map<T, R, Cmp, Alloc>::key_type; using key_type = typename std::map<T, R, Cmp, Alloc>::key_type;
......
...@@ -20,21 +20,16 @@ namespace ext { ...@@ -20,21 +20,16 @@ namespace ext {
template < class T, class R > template < class T, class R >
class pair : public std::pair < T, R > { class pair : public std::pair < T, R > {
public: public:
#ifdef __clang__
using std::pair < T, R >::pair; using std::pair < T, R >::pair;
using std::pair < T, R >::operator =; using std::pair < T, R >::operator =;
#else #ifndef __clang__
pair ( const pair & other ) = default; pair ( const pair & other ) = default;
   
pair ( pair && other ) = default; pair ( pair && other ) = default;
   
using std::pair < T, R >::pair;
pair & operator = ( pair && other ) = default; pair & operator = ( pair && other ) = default;
   
pair & operator = ( const pair & other ) = default; pair & operator = ( const pair & other ) = default;
using std::pair < T, R >::operator =;
#endif #endif
}; };
   
......
...@@ -21,10 +21,9 @@ namespace ext { ...@@ -21,10 +21,9 @@ namespace ext {
template < typename T, typename Cmp = std::less < >, typename Alloc = std::allocator < 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 >, AllocFix < Alloc > {
public: public:
#ifdef __clang__
using std::set < T, Cmp, Alloc >::set; using std::set < T, Cmp, Alloc >::set;
using std::set < T, Cmp, Alloc >::operator =; using std::set < T, Cmp, Alloc >::operator =;
#else #ifndef __clang__
set ( ) noexcept : std::set < T, Cmp, Alloc > ( ) { set ( ) noexcept : std::set < T, Cmp, Alloc > ( ) {
} }
   
...@@ -32,13 +31,9 @@ public: ...@@ -32,13 +31,9 @@ public:
   
set ( set && other ) = default; set ( set && other ) = default;
   
using std::set < T, Cmp, Alloc >::set;
set & operator = ( set && other ) = default; set & operator = ( set && other ) = default;
   
set & operator = ( const set & other ) = default; set & operator = ( const set & other ) = default;
using std::set < T, Cmp, Alloc >::operator =;
#endif #endif
}; };
   
......
...@@ -19,10 +19,9 @@ namespace ext { ...@@ -19,10 +19,9 @@ namespace ext {
   
class string : public std::string { class string : public std::string {
public: public:
#ifdef __clang__
using std::string::string; using std::string::string;
using std::string::operator =; using std::string::operator =;
#else #ifndef __clang__
string ( ) noexcept : std::string ( ) { string ( ) noexcept : std::string ( ) {
} }
   
...@@ -30,13 +29,9 @@ public: ...@@ -30,13 +29,9 @@ public:
   
string ( string && other ) = default; string ( string && other ) = default;
   
using std::string::string;
string & operator = ( string && other ) = default; string & operator = ( string && other ) = default;
   
string & operator = ( const string & other ) = default; string & operator = ( const string & other ) = default;
using std::string::operator =;
#endif #endif
string ( const std::string & other ) noexcept : std::string ( other ) { string ( const std::string & other ) noexcept : std::string ( other ) {
} }
......
...@@ -20,10 +20,9 @@ namespace ext { ...@@ -20,10 +20,9 @@ namespace ext {
template < typename ... Ts > template < typename ... Ts >
class tuple : public std::tuple < Ts ... > { class tuple : public std::tuple < Ts ... > {
public: public:
#ifdef __clang__
using std::tuple< Ts ... >::tuple; using std::tuple< Ts ... >::tuple;
using std::tuple< Ts ... >::operator =; using std::tuple< Ts ... >::operator =;
#else #ifndef __clang__
tuple ( ) noexcept : std::tuple < Ts ... > ( ) { tuple ( ) noexcept : std::tuple < Ts ... > ( ) {
} }
   
...@@ -31,13 +30,9 @@ public: ...@@ -31,13 +30,9 @@ public:
   
tuple ( tuple && other ) = default; tuple ( tuple && other ) = default;
   
using std::tuple < Ts ... >::tuple;
tuple & operator = ( tuple && other ) = default; tuple & operator = ( tuple && other ) = default;
   
tuple & operator = ( const tuple & other ) = default; tuple & operator = ( const tuple & other ) = default;
using std::tuple < Ts ... >::operator =;
#endif #endif
}; };
   
......
...@@ -21,10 +21,9 @@ namespace ext { ...@@ -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 > > > 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 >, AllocFix < Alloc > {
public: public:
#ifdef __clang__
using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::unordered_map; using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::unordered_map;
using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::operator =; using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::operator =;
#else #ifndef __clang__
unordered_map ( ) noexcept : std::unordered_map < T, R, Hash, KeyEqual, Alloc > ( ) { unordered_map ( ) noexcept : std::unordered_map < T, R, Hash, KeyEqual, Alloc > ( ) {
} }
   
...@@ -32,13 +31,9 @@ public: ...@@ -32,13 +31,9 @@ public:
   
unordered_map ( unordered_map && other ) = default; 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 = ( unordered_map && other ) = default;
   
unordered_map & operator = ( const unordered_map & other ) = default; unordered_map & operator = ( const unordered_map & other ) = default;
using std::unordered_map < T, R, Hash, KeyEqual, Alloc >::operator =;
#endif #endif
}; };
   
......
...@@ -23,10 +23,9 @@ namespace ext { ...@@ -23,10 +23,9 @@ namespace ext {
template < class T, class Alloc = std::allocator < 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 >, AllocFix < Alloc > {
public: public:
#ifdef __clang__
using std::vector< T, Alloc >::vector; using std::vector< T, Alloc >::vector;
using std::vector< T, Alloc >::operator =; using std::vector< T, Alloc >::operator =;
#else #ifndef __clang__
vector ( ) noexcept : std::vector < T, Alloc > ( ) { vector ( ) noexcept : std::vector < T, Alloc > ( ) {
} }
   
...@@ -34,13 +33,9 @@ public: ...@@ -34,13 +33,9 @@ public:
   
vector ( vector && other ) = default; vector ( vector && other ) = default;
   
using std::vector < T, Alloc >::vector;
vector & operator = ( vector && other ) = default; vector & operator = ( vector && other ) = default;
   
vector & operator = ( const vector & other ) = default; vector & operator = ( const vector & other ) = default;
using std::vector < T, Alloc >::operator =;
#endif #endif
}; };
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment