From 2b8a8787171695d8ca1ced835cdd68c3cbf9acda Mon Sep 17 00:00:00 2001 From: Thomas DeRensis Date: Fri, 1 Oct 2021 10:02:54 -0400 Subject: [PATCH] Prevent unused variable warnings when using single row vectors and matrices --- linalg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linalg.h b/linalg.h index aff292a..b60ec8a 100644 --- a/linalg.h +++ b/linalg.h @@ -215,8 +215,8 @@ namespace linalg // NOTE: vec does NOT have a constructor from pointer, this can conflict with initializing its single element from zero template constexpr explicit vec(const vec & v) : vec(static_cast(v.x)) {} - constexpr const T & operator[] (int i) const { return x; } - LINALG_CONSTEXPR14 T & operator[] (int i) { return x; } + constexpr const T & operator[] (int i) const { (void)i; return x; } + LINALG_CONSTEXPR14 T & operator[] (int i) { (void)i; return x; } template> constexpr vec(const U & u) : vec(converter{}(u)) {} template> constexpr operator U () const { return converter{}(*this); } @@ -293,8 +293,8 @@ namespace linalg template constexpr explicit mat(const mat & m) : mat(V(m.x)) {} constexpr vec row(int i) const { return {x[i]}; } - constexpr const V & operator[] (int j) const { return x; } - LINALG_CONSTEXPR14 V & operator[] (int j) { return x; } + constexpr const V & operator[] (int j) const { (void)j; return x; } + LINALG_CONSTEXPR14 V & operator[] (int j) { (void)j; return x; } template> constexpr mat(const U & u) : mat(converter{}(u)) {} template> constexpr operator U () const { return converter{}(*this); }