Implement a JSON string parser in C++.
Usestd::variant
to hold either a raw character pointer (const char*
) or a vector of character pointers (std::vector<const char*>
).
The parser should handle the following cases:
- Single string input
- Example:
"hello world"
- Should be stored as
const char*
insidestd::variant
.- Array of strings
- Example:
["hello world"]
- Should be stored as
std::vector<const char*>
.- Multiple strings in an array
- Example:
["hello world", "!"]
- Should be stored as
std::vector<const char*>
with multiple elements.- Edge cases:
- Empty string:
""
- Empty array:
[]
Ensure proper memory management and avoid memory leaks.
Good luck!
我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。
We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.