std::unique_ptr Decoder::decode()

in hessian2/basic_codec/ref_object_codec.cc [7:19]


std::unique_ptr<RefObject> Decoder::decode() {
  auto ret = reader_->read<uint8_t>();
  ABSL_ASSERT(ret.first);
  ABSL_ASSERT(ret.second == 0x51);
  auto ref = decode<int32_t>();
  if (!ref) {
    return nullptr;
  }
  if (static_cast<uint32_t>(*ref) >= values_ref_.size()) {
    return nullptr;
  }
  return std::make_unique<RefObject>(values_ref_[*ref]);
}