3 ms·
std::cout << std::vector<char>{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\0'}.data() << std::endl; I'm too cheap to pay triple the price for a li
by mike_hock 5y ago
std::cout << std::vector<char>{'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '\0'}.data() << std::endl;
I'm too cheap to pay triple the price for a little bit of convenience.
- Subsentient 5y agostatic const char StringLiteral[] = "hello world"; std::vector<char> Derp; Derp.resize(sizeof StringLiteral); memcpy(Derp.data(), StringLiteral, sizeof StringLiteral);
- deleted 5y ago[deleted]