diff --git a/bflibcpp/makefile b/bflibcpp/makefile index 6778839..4291164 100644 --- a/bflibcpp/makefile +++ b/bflibcpp/makefile @@ -33,11 +33,13 @@ defer ifeq ($(CONFIG),release) # release BIN_NAME = $(LIB_FILE_NAME_RELEASE) FLAGS = $(CPPFLAGS) -Isrc/ $(CPPSTD) -I../bflibc/bin/release + ### Debug settings else ifeq ($(CONFIG),debug) # debug BIN_NAME = $(LIB_FILE_NAME_DEBUG) #ADDR_SANITIZER = -fsanitize=address FLAGS = $(CPPFLAGS) -DDEBUG -g -Isrc/ $(ADDR_SANITIZER) $(CPPSTD) -I../bflibc/bin/debug + ### Test settings else ifeq ($(CONFIG),test) # test BIN_NAME = libbfcpp-test diff --git a/bflibcpp/src/array.hpp b/bflibcpp/src/array.hpp index df20bf1..342ea99 100644 --- a/bflibcpp/src/array.hpp +++ b/bflibcpp/src/array.hpp @@ -14,6 +14,7 @@ #include "vector.hpp" #include #include "exception.hpp" +#include "swap.hpp" namespace BF { @@ -26,7 +27,7 @@ namespace BF { * Objects stored in array are assumed to be owned by owner of array * object */ -template +template class Array : public Vector { public: virtual const char * className() const { @@ -382,12 +383,6 @@ class Array : public Vector { public: - /* - T operator[](S index) const { - return this->objectAtIndex(index); - } - */ - void operator=(const std::initializer_list & list) { this->saveArray(list); } @@ -400,6 +395,14 @@ class Array : public Vector { return *this; } + virtual T operator[](S index) const { + return this->objectAtIndex(index); + } + + virtual T & operator[](S index) { + return this->refObjectAtIndex(index); + } + // Comparators public: /** diff --git a/bflibcpp/src/bflibcpp.hpp b/bflibcpp/src/bflibcpp.hpp index 4ec7af3..d3a1599 100644 --- a/bflibcpp/src/bflibcpp.hpp +++ b/bflibcpp/src/bflibcpp.hpp @@ -31,6 +31,7 @@ #include "deque.hpp" #include "hash.hpp" #include "defer.hpp" +#include "sort.hpp" #endif // BFLIBCPP_HPP diff --git a/bflibcpp/src/list.hpp b/bflibcpp/src/list.hpp index 86eefe8..541d5f7 100644 --- a/bflibcpp/src/list.hpp +++ b/bflibcpp/src/list.hpp @@ -9,11 +9,14 @@ #include "access.hpp" #include "vector.hpp" #include "exception.hpp" +#include "swap.hpp" #include #include namespace BF { +template