Last active
June 2, 2017 18:22
-
-
Save njlr/008759718b186b899c4f0b88af0bdd28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a vector of 10 elements, all initialized to 0 | |
auto v = Vector<10>(0); | |
// Set the 1st element to 7 | |
v[0] = 7; | |
// Set the 9th element to 3 | |
v[8] = 3; | |
// Print the sum of all elements | |
std::cout << v.sum() << std::endl; | |
// Error! | |
v[10] = 2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment