Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Prevent unused variable warnings when using single row vectors and matrices #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tderensis
Copy link

No description provided.

@@ -215,8 +215,8 @@ namespace linalg
// NOTE: vec<T,1> does NOT have a constructor from pointer, this can conflict with initializing its single element from zero
template<class U>
constexpr explicit vec(const vec<U,1> & v) : vec(static_cast<T>(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; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing i would have the same effect I think:

constexpr const T & operator[] (int) const { return x; }

see https://godbolt.org/z/6E5r88sdx

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants