~/talk

JSON in C++ - Designing a Type for Working With JSON Values

Talkat C++Online 2025 · 2025-02-26..02-28· [c-and-cpp, api-design]
links:none on file
slides:none on file

Designs a C++17 JSON value type that uses C++17 std::variant-based union for null/bool/int64/double/string/array/object, documents choosing rule-of-zero for the simple version and rule-of-five when using a placement-storage workaround, and adds allocator-aware basic_value support with rebound allocators. Implements an MSVC overload workaround for ambiguous literal construction and an incomplete-type storage hack to support older libstdc++/libc++ versions. Produces a working library ~1.5k lines long and files a Clang bug for a copy-construction false negative.

AI-written summary · about

  1. 0:00Introduction
  2. 1:07JSON basics and C++ mapping
  3. 7:30Designing the Value type
  4. 16:51Rule of Zero and operators
  5. 23:06Compiler workarounds
  6. 30:46Resolving JSON paths
  7. 41:58Incomplete type workaround
  8. 46:35Visitor pattern implementation
  9. 53:47Allocator support
  10. 59:15Summary and conclusion
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.