summaryrefslogtreecommitdiff
path: root/core/vector.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:41:43 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 21:57:34 +0200
commit0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch)
tree198d4ff7665d89307f6ca2469fa38620a9eb1672 /core/vector.h
parent07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff)
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'core/vector.h')
-rw-r--r--core/vector.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/vector.h b/core/vector.h
index 4521b29339..696984ac28 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -70,8 +70,9 @@ public:
void remove(int p_index) { _cowdata.remove(p_index); }
void erase(const T &p_val) {
int idx = find(p_val);
- if (idx >= 0)
+ if (idx >= 0) {
remove(idx);
+ }
}
void invert();
@@ -94,8 +95,9 @@ public:
template <class C>
void sort_custom() {
int len = _cowdata.size();
- if (len == 0)
+ if (len == 0) {
return;
+ }
T *data = ptrw();
SortArray<T, C> sorter;
@@ -168,12 +170,14 @@ void Vector<T>::invert() {
template <class T>
void Vector<T>::append_array(Vector<T> p_other) {
const int ds = p_other.size();
- if (ds == 0)
+ if (ds == 0) {
return;
+ }
const int bs = size();
resize(bs + ds);
- for (int i = 0; i < ds; ++i)
+ for (int i = 0; i < ds; ++i) {
ptrw()[bs + i] = p_other[i];
+ }
}
template <class T>