Enable all warnings and fix a few
This commit is contained in:
parent
d1fd4eb017
commit
3365d5986b
@ -4,5 +4,7 @@
|
||||
env = DefaultEnvironment(tools=['default', 'compilation_db'])
|
||||
env.CompilationDatabase()
|
||||
|
||||
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Werror", "-pedantic"])
|
||||
|
||||
# Build the output program
|
||||
Program('vector.out', Glob('*.cpp'))
|
||||
|
6
Vector.h
6
Vector.h
@ -25,7 +25,7 @@ class Vector {
|
||||
}
|
||||
|
||||
// Move Constructor using the copy-and-swap-idiom
|
||||
Vector(Vector &&other) : data((T *)::operator new(capacity * sizeof(T))) {
|
||||
Vector(Vector &&other) : data(nullptr) {
|
||||
swap(*this, other);
|
||||
}
|
||||
|
||||
@ -160,9 +160,9 @@ class Vector {
|
||||
}
|
||||
|
||||
private:
|
||||
T *data;
|
||||
unsigned int element_count;
|
||||
unsigned int capacity;
|
||||
unsigned int element_count;
|
||||
T *data;
|
||||
|
||||
bool is_using_excessive_memory() {
|
||||
return 10 + element_count * 2 < capacity;
|
||||
|
Loading…
x
Reference in New Issue
Block a user