10000 Prevent unused variable warnings when using single row vectors and matrices by tderensis · Pull Request #32 · sgorsten/linalg · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

New issue

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

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

Already on GitHub? Sign in to your account

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

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

Successfully merging this pull request may close these issues.

2 participants
0