Skip to main content

Checkpoint: Serializer with specialization

Challenge on lesson: Checkpoint: Serializer

Implement template <typename T> struct Serializer with static std::string to(const T&) producing std::to_string(v); a **full specialization** for std::string returning the string unchanged; and a **partial specialization** for std::vector<T> producing "[a,b,c]" (no spaces), recursively serializing elements. Nested vectors must work: a std::vector<std::vector<int>> serializes as "[[1,2],[3]]".

Difficulty: intermediate

Back to lesson: Checkpoint: Serializer