decode_traits.md

August 6, 2026 ยท View on GitHub

jsoncons::reflect::decode_traits

#include <jsoncons/reflect/decode_traits.hpp>

decode_traits define a compile time template based interface for converting a stream of staj_events into a C++ data structure. They are used in the decode_<format> functions such as decode_json.

template <typename T,typename Enable = void>
struct decode_traits
{
    using value_type = T;
    using result_type = read_result<value_type>;
    
    template <typename Alloc,typename TempAlloc,typename CharT>
    static result_type decode(const allocator_set<Alloc,TempAlloc>& aset,
        basic_staj_cursor<CharT>& cursor);
};