You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
In the following snippet, I want the menu variable to have empty content at index 0, the current contents of index 0 to be at index1, and the current contents
of index 1 at index2
#include <iostream>
#include <vector>
#include <string>
// Define a struct to represent menu items
struct MenuItem {
std::string name;
std::vector<std::string> options;
};
int main() {
// Initialize menu items directly in an array
std::vector<MenuItem> menu = {
{"", {}}, // or std::optional<std::string> name; and {std::nullopt, {}},