diff options
Diffstat (limited to 'src/support')
-rw-r--r-- | src/support/name.h | 2 | ||||
-rw-r--r-- | src/support/small_vector.h | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/support/name.h b/src/support/name.h index 2bc50abf0..615740e09 100644 --- a/src/support/name.h +++ b/src/support/name.h @@ -17,7 +17,7 @@ #ifndef wasm_support_name_h #define wasm_support_name_h -#include <cstring> +#include <string> #include "emscripten-optimizer/istring.h" diff --git a/src/support/small_vector.h b/src/support/small_vector.h index 7f00bd4a6..d4ad961a7 100644 --- a/src/support/small_vector.h +++ b/src/support/small_vector.h @@ -38,17 +38,15 @@ template<typename T, size_t N> class SmallVector { std::vector<T> flexible; public: + using value_type = T; + SmallVector() {} T& operator[](size_t i) { - if (i < N) { - return fixed[i]; - } else { - return flexible[i - N]; - } + return const_cast<T&>(static_cast<const SmallVector<T, N>&>(*this)[i]); } - T operator[](size_t i) const { + const T& operator[](size_t i) const { if (i < N) { return fixed[i]; } else { |