Created
October 26, 2022 10:27
-
-
Save BioBoost/032125e52db894d385ace47f0863a720 to your computer and use it in GitHub Desktop.
Using std::array as 2d buffer
This file contains 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
#include <iostream> | |
#include <array> | |
#include <string> | |
using namespace std; | |
int main() { | |
cout << "Demo std::array" << endl; | |
std::array<std::array<std::string, 10>, 20> buffer; | |
buffer[0][0] = "hello"; | |
buffer[0][2] = "world"; | |
buffer[2][3] = "dude"; | |
for (auto & line : buffer) { | |
for (auto & element : line) { | |
cout << element << " | "; | |
} | |
cout << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment