diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 13:23:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch) | |
tree | a27e497da7104dd0a64f98a04fa3067668735e91 /core/vmap.h | |
parent | 710b34b70227becdc652b4ae027fe0ac47409642 (diff) | |
download | redot-engine-0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a.tar.gz |
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.
This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.
There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).
Part of #33027.
Diffstat (limited to 'core/vmap.h')
-rw-r--r-- | core/vmap.h | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/core/vmap.h b/core/vmap.h index 848b5055fa..358b6260a4 100644 --- a/core/vmap.h +++ b/core/vmap.h @@ -38,14 +38,12 @@ template <class T, class V> class VMap { public: struct Pair { - T key; V value; _FORCE_INLINE_ Pair() {} _FORCE_INLINE_ Pair(const T &p_key, const V &p_value) { - key = p_key; value = p_value; } @@ -55,7 +53,6 @@ private: CowData<Pair> _cowdata; _FORCE_INLINE_ int _find(const T &p_val, bool &r_exact) const { - r_exact = false; if (_cowdata.empty()) return 0; @@ -89,7 +86,6 @@ private: } _FORCE_INLINE_ int _find_exact(const T &p_val) const { - if (_cowdata.empty()) return -1; @@ -115,7 +111,6 @@ private: public: int insert(const T &p_key, const V &p_val) { - bool exact; int pos = _find(p_key, exact); if (exact) { @@ -127,12 +122,10 @@ public: } bool has(const T &p_val) const { - return _find_exact(p_val) != -1; } void erase(const T &p_val) { - int pos = _find_exact(p_val); if (pos < 0) return; @@ -140,12 +133,10 @@ public: } int find(const T &p_val) const { - return _find_exact(p_val); } int find_nearest(const T &p_val) const { - bool exact; return _find(p_val, exact); } @@ -154,37 +145,30 @@ public: _FORCE_INLINE_ bool empty() const { return _cowdata.empty(); } const Pair *get_array() const { - return _cowdata.ptr(); } Pair *get_array() { - return _cowdata.ptrw(); } const V &getv(int p_index) const { - return _cowdata.get(p_index).value; } V &getv(int p_index) { - return _cowdata.get_m(p_index).value; } const T &getk(int p_index) const { - return _cowdata.get(p_index).key; } T &getk(int p_index) { - return _cowdata.get_m(p_index).key; } inline const V &operator[](const T &p_key) const { - int pos = _find_exact(p_key); CRASH_COND(pos < 0); @@ -193,7 +177,6 @@ public: } inline V &operator[](const T &p_key) { - int pos = _find_exact(p_key); if (pos < 0) { pos = insert(p_key, V()); |