Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/common/HashSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ template <class Value> class HashSet
typedef typename Super::iterator iterator;
typedef typename Super::const_iterator const_iterator;

HashSet<Value>()
HashSet()
{
}

HashSet<Value>( const std::initializer_list<Value> &initializerList )
HashSet( const std::initializer_list<Value> &initializerList )
: _container( initializerList )
{
}
Expand All @@ -44,35 +44,35 @@ template <class Value> class HashSet
_container.insert( value );
}

void insert( const HashSet<Value> &other )
void insert( const HashSet &other )
{
for ( auto it = other.begin(); it != other.end(); ++it )
_container.insert( *it );
}

void operator+=( const HashSet<Value> &other )
void operator+=( const HashSet &other )
{
insert( other );
}

HashSet<Value> operator+( const HashSet<Value> &other )
HashSet operator+( const HashSet &other )
{
HashSet<Value> result = *this;
HashSet result = *this;
result.insert( other );
return result;
}

bool operator==( const HashSet<Value> &other ) const
bool operator==( const HashSet &other ) const
{
return _container == other._container;
}

bool operator!=( const HashSet<Value> &other ) const
bool operator!=( const HashSet &other ) const
{
return _container != other._container;
}

bool operator<( const HashSet<Value> &other ) const
bool operator<( const HashSet &other ) const
{
return _container < other._container;
}
Expand Down
16 changes: 8 additions & 8 deletions src/common/List.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ template <class T> class List
typedef typename Super::reverse_iterator reverse_iterator;
typedef typename Super::const_reverse_iterator const_reverse_iterator;

List<T>()
List()
{
}

List<T>( const std::initializer_list<T> &initializerList )
List( const std::initializer_list<T> &initializerList )
: _container( initializerList )
{
}

List<T>( unsigned size, T value )
List( unsigned size, T value )
: _container( size, value )
{
}

template <class InputIt>
List<T>( InputIt begin, InputIt end )
List( InputIt begin, InputIt end )
: _container( begin, end )
{
}

void append( const List<T> &other )
void append( const List &other )
{
for ( const auto &element : other )
_container.push_back( element );
Expand All @@ -67,7 +67,7 @@ template <class T> class List
_container.push_front( value );
}

void appendHead( const List<T> &other )
void appendHead( const List &other )
{
_container.insert( begin(), other.begin(), other.end() );
}
Expand Down Expand Up @@ -188,12 +188,12 @@ template <class T> class List
_container.remove_if( p );
}

bool operator==( const List<T> &other ) const
bool operator==( const List &other ) const
{
return _container == other._container;
}

bool operator!=( const List<T> &other ) const
bool operator!=( const List &other ) const
{
return _container != other._container;
}
Expand Down
30 changes: 15 additions & 15 deletions src/common/Set.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ template <class Value> class Set
typedef typename Super::const_iterator const_iterator;
typedef typename Super::const_reverse_iterator const_reverse_iterator;

Set<Value>()
Set()
{
}

Set<Value>( const std::initializer_list<Value> &initializerList )
Set( const std::initializer_list<Value> &initializerList )
: _container( initializerList )
{
}
Expand All @@ -50,7 +50,7 @@ template <class Value> class Set
_container.insert( value );
}

void insert( const Set<Value> &other )
void insert( const Set &other )
{
for ( auto it = other.begin(); it != other.end(); ++it )
_container.insert( *it );
Expand All @@ -62,43 +62,43 @@ template <class Value> class Set
_container.insert( *it );
}

void operator+=( const Set<Value> &other )
void operator+=( const Set &other )
{
insert( other );
}

Set<Value> operator+( const Set<Value> &other )
Set operator+( const Set &other )
{
Set<Value> result = *this;
Set result = *this;
result.insert( other );
return result;
}

bool operator==( const Set<Value> &other ) const
bool operator==( const Set &other ) const
{
return _container == other._container;
}

bool operator!=( const Set<Value> &other ) const
bool operator!=( const Set &other ) const
{
return _container != other._container;
}

bool operator<( const Set<Value> &other ) const
bool operator<( const Set &other ) const
{
return _container < other._container;
}

static bool containedIn( const Set<Value> &one, const Set<Value> &two )
static bool containedIn( const Set &one, const Set &two )
// Is one contained in two?
{
return Set<Value>::difference( one, two ).empty();
return Set::difference( one, two ).empty();
}

static Set<Value> difference( const Set<Value> &one, const Set<Value> &two )
static Set difference( const Set &one, const Set &two )
// Elements that appear in one, but do not appear in two.
{
Set<Value> difference;
Set difference;
std::set_difference( one.begin(),
one.end(),
two.begin(),
Expand All @@ -107,9 +107,9 @@ template <class Value> class Set
return difference;
}

static Set<Value> intersection( const Set<Value> &one, const Set<Value> &two )
static Set intersection( const Set &one, const Set &two )
{
Set<Value> intersection;
Set intersection;
std::set_intersection( one.begin(),
one.end(),
two.begin(),
Expand Down
26 changes: 13 additions & 13 deletions src/common/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,29 @@ template <class T> class Vector

typedef typename Super::const_reverse_iterator const_reverse_iterator;

Vector<T>()
Vector()
{
}

Vector<T>( const Vector<T> &rhs ) = default;
Vector( const Vector &rhs ) = default;

Vector<T>( const std::initializer_list<T> &initializerList )
Vector( const std::initializer_list<T> &initializerList )
: _container( initializerList )
{
}

Vector<T>( unsigned size )
Vector( unsigned size )
: _container( size )
{
}

Vector<T>( unsigned size, T value )
Vector( unsigned size, T value )
: _container( size, value )
{
}

template <class InputIt>
Vector<T>( InputIt begin, InputIt end )
Vector( InputIt begin, InputIt end )
: _container( begin, end )
{
}
Expand Down Expand Up @@ -238,9 +238,9 @@ template <class T> class Vector
std::shuffle( _container.begin(), _container.end(), g );
}

Vector<T> operator+( const Vector<T> &other )
Vector operator+( const Vector &other )
{
Vector<T> output;
Vector output;

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

Vector<T> &operator+=( const Vector<T> &other )
Vector &operator+=( const Vector &other )
{
( *this ) = ( *this ) + other;
return *this;
Expand Down Expand Up @@ -293,12 +293,12 @@ template <class T> class Vector
return value;
}

bool operator==( const Vector<T> &other ) const
bool operator==( const Vector &other ) const
{
if ( size() != other.size() )
return false;

Vector<T> copyOfOther = other;
Vector copyOfOther = other;

for ( unsigned i = 0; i < size(); ++i )
{
Expand All @@ -311,12 +311,12 @@ template <class T> class Vector
return true;
}

bool operator!=( const Vector<T> &other ) const
bool operator!=( const Vector &other ) const
{
return !( *this == other );
}

Vector &operator=( const Vector<T> &other )
Vector &operator=( const Vector &other )
{
_container = other._container;
return *this;
Expand Down
Loading