cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
c++ operator[] operator,
c++ operator[] operator,
Aug 27, 2018 at 11:19pm UTC
Wu zhen hai
(112)
I want to implement a matrix operator[], like Python
1
2
3
Matrix<4,4> m; m[0,0] = 0; m[0,1] = 0;
How to implement?
Aug 27, 2018 at 11:49pm UTC
mbozzi
(3932)
You can't - it's a language limitation.
Use the parentheses instead (
m(0, 1)
), or use two pairs of brackets:
m[0][1]
;
Last edited on
Aug 27, 2018 at 11:49pm UTC
Topic archived. No new replies allowed.