Skip to content

Commit afcebce

Browse files
committed
Fixed deprecated constructors with templates (#855)
1 parent 90f5271 commit afcebce

File tree

4 files changed

+45
-45
lines changed

4 files changed

+45
-45
lines changed

src/common/HashSet.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ template <class Value> class HashSet
3030
typedef typename Super::iterator iterator;
3131
typedef typename Super::const_iterator const_iterator;
3232

33-
HashSet<Value>()
33+
HashSet()
3434
{
3535
}
3636

37-
HashSet<Value>( const std::initializer_list<Value> &initializerList )
37+
HashSet( const std::initializer_list<Value> &initializerList )
3838
: _container( initializerList )
3939
{
4040
}
@@ -44,35 +44,35 @@ template <class Value> class HashSet
4444
_container.insert( value );
4545
}
4646

47-
void insert( const HashSet<Value> &other )
47+
void insert( const HashSet &other )
4848
{
4949
for ( auto it = other.begin(); it != other.end(); ++it )
5050
_container.insert( *it );
5151
}
5252

53-
void operator+=( const HashSet<Value> &other )
53+
void operator+=( const HashSet &other )
5454
{
5555
insert( other );
5656
}
5757

58-
HashSet<Value> operator+( const HashSet<Value> &other )
58+
HashSet operator+( const HashSet &other )
5959
{
60-
HashSet<Value> result = *this;
60+
HashSet result = *this;
6161
result.insert( other );
6262
return result;
6363
}
6464

65-
bool operator==( const HashSet<Value> &other ) const
65+
bool operator==( const HashSet &other ) const
6666
{
6767
return _container == other._container;
6868
}
6969

70-
bool operator!=( const HashSet<Value> &other ) const
70+
bool operator!=( const HashSet &other ) const
7171
{
7272
return _container != other._container;
7373
}
7474

75-
bool operator<( const HashSet<Value> &other ) const
75+
bool operator<( const HashSet &other ) const
7676
{
7777
return _container < other._container;
7878
}

src/common/List.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,27 @@ template <class T> class List
3131
typedef typename Super::reverse_iterator reverse_iterator;
3232
typedef typename Super::const_reverse_iterator const_reverse_iterator;
3333

34-
List<T>()
34+
List()
3535
{
3636
}
3737

38-
List<T>( const std::initializer_list<T> &initializerList )
38+
List( const std::initializer_list<T> &initializerList )
3939
: _container( initializerList )
4040
{
4141
}
4242

43-
List<T>( unsigned size, T value )
43+
List( unsigned size, T value )
4444
: _container( size, value )
4545
{
4646
}
4747

4848
template <class InputIt>
49-
List<T>( InputIt begin, InputIt end )
49+
List( InputIt begin, InputIt end )
5050
: _container( begin, end )
5151
{
5252
}
5353

54-
void append( const List<T> &other )
54+
void append( const List &other )
5555
{
5656
for ( const auto &element : other )
5757
_container.push_back( element );
@@ -67,7 +67,7 @@ template <class T> class List
6767
_container.push_front( value );
6868
}
6969

70-
void appendHead( const List<T> &other )
70+
void appendHead( const List &other )
7171
{
7272
_container.insert( begin(), other.begin(), other.end() );
7373
}
@@ -188,12 +188,12 @@ template <class T> class List
188188
_container.remove_if( p );
189189
}
190190

191-
bool operator==( const List<T> &other ) const
191+
bool operator==( const List &other ) const
192192
{
193193
return _container == other._container;
194194
}
195195

196-
bool operator!=( const List<T> &other ) const
196+
bool operator!=( const List &other ) const
197197
{
198198
return _container != other._container;
199199
}

src/common/Set.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ template <class Value> class Set
3636
typedef typename Super::const_iterator const_iterator;
3737
typedef typename Super::const_reverse_iterator const_reverse_iterator;
3838

39-
Set<Value>()
39+
Set()
4040
{
4141
}
4242

43-
Set<Value>( const std::initializer_list<Value> &initializerList )
43+
Set( const std::initializer_list<Value> &initializerList )
4444
: _container( initializerList )
4545
{
4646
}
@@ -50,7 +50,7 @@ template <class Value> class Set
5050
_container.insert( value );
5151
}
5252

53-
void insert( const Set<Value> &other )
53+
void insert( const Set &other )
5454
{
5555
for ( auto it = other.begin(); it != other.end(); ++it )
5656
_container.insert( *it );
@@ -62,43 +62,43 @@ template <class Value> class Set
6262
_container.insert( *it );
6363
}
6464

65-
void operator+=( const Set<Value> &other )
65+
void operator+=( const Set &other )
6666
{
6767
insert( other );
6868
}
6969

70-
Set<Value> operator+( const Set<Value> &other )
70+
Set operator+( const Set &other )
7171
{
72-
Set<Value> result = *this;
72+
Set result = *this;
7373
result.insert( other );
7474
return result;
7575
}
7676

77-
bool operator==( const Set<Value> &other ) const
77+
bool operator==( const Set &other ) const
7878
{
7979
return _container == other._container;
8080
}
8181

82-
bool operator!=( const Set<Value> &other ) const
82+
bool operator!=( const Set &other ) const
8383
{
8484
return _container != other._container;
8585
}
8686

87-
bool operator<( const Set<Value> &other ) const
87+
bool operator<( const Set &other ) const
8888
{
8989
return _container < other._container;
9090
}
9191

92-
static bool containedIn( const Set<Value> &one, const Set<Value> &two )
92+
static bool containedIn( const Set &one, const Set &two )
9393
// Is one contained in two?
9494
{
95-
return Set<Value>::difference( one, two ).empty();
95+
return Set::difference( one, two ).empty();
9696
}
9797

98-
static Set<Value> difference( const Set<Value> &one, const Set<Value> &two )
98+
static Set difference( const Set &one, const Set &two )
9999
// Elements that appear in one, but do not appear in two.
100100
{
101-
Set<Value> difference;
101+
Set difference;
102102
std::set_difference( one.begin(),
103103
one.end(),
104104
two.begin(),
@@ -107,9 +107,9 @@ template <class Value> class Set
107107
return difference;
108108
}
109109

110-
static Set<Value> intersection( const Set<Value> &one, const Set<Value> &two )
110+
static Set intersection( const Set &one, const Set &two )
111111
{
112-
Set<Value> intersection;
112+
Set intersection;
113113
std::set_intersection( one.begin(),
114114
one.end(),
115115
two.begin(),

src/common/Vector.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@ template <class T> class Vector
3333

3434
typedef typename Super::const_reverse_iterator const_reverse_iterator;
3535

36-
Vector<T>()
36+
Vector()
3737
{
3838
}
3939

40-
Vector<T>( const Vector<T> &rhs ) = default;
40+
Vector( const Vector &rhs ) = default;
4141

42-
Vector<T>( const std::initializer_list<T> &initializerList )
42+
Vector( const std::initializer_list<T> &initializerList )
4343
: _container( initializerList )
4444
{
4545
}
4646

47-
Vector<T>( unsigned size )
47+
Vector( unsigned size )
4848
: _container( size )
4949
{
5050
}
5151

52-
Vector<T>( unsigned size, T value )
52+
Vector( unsigned size, T value )
5353
: _container( size, value )
5454
{
5555
}
5656

5757
template <class InputIt>
58-
Vector<T>( InputIt begin, InputIt end )
58+
Vector( InputIt begin, InputIt end )
5959
: _container( begin, end )
6060
{
6161
}
@@ -238,9 +238,9 @@ template <class T> class Vector
238238
std::shuffle( _container.begin(), _container.end(), g );
239239
}
240240

241-
Vector<T> operator+( const Vector<T> &other )
241+
Vector operator+( const Vector &other )
242242
{
243-
Vector<T> output;
243+
Vector output;
244244

245245
for ( unsigned i = 0; i < this->size(); ++i )
246246
output.append( ( *this )[i] );
@@ -251,7 +251,7 @@ template <class T> class Vector
251251
return output;
252252
}
253253

254-
Vector<T> &operator+=( const Vector<T> &other )
254+
Vector &operator+=( const Vector &other )
255255
{
256256
( *this ) = ( *this ) + other;
257257
return *this;
@@ -293,12 +293,12 @@ template <class T> class Vector
293293
return value;
294294
}
295295

296-
bool operator==( const Vector<T> &other ) const
296+
bool operator==( const Vector &other ) const
297297
{
298298
if ( size() != other.size() )
299299
return false;
300300

301-
Vector<T> copyOfOther = other;
301+
Vector copyOfOther = other;
302302

303303
for ( unsigned i = 0; i < size(); ++i )
304304
{
@@ -311,12 +311,12 @@ template <class T> class Vector
311311
return true;
312312
}
313313

314-
bool operator!=( const Vector<T> &other ) const
314+
bool operator!=( const Vector &other ) const
315315
{
316316
return !( *this == other );
317317
}
318318

319-
Vector &operator=( const Vector<T> &other )
319+
Vector &operator=( const Vector &other )
320320
{
321321
_container = other._container;
322322
return *this;

0 commit comments

Comments
 (0)