/**
 * Autogenerated by Thrift for thrift/compiler/test/fixtures/lazy_deserialization/src/simple.thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated @nocommit
 */
#include "thrift/compiler/test/fixtures/lazy_deserialization/gen-cpp2/simple_types.h"
#include "thrift/compiler/test/fixtures/lazy_deserialization/gen-cpp2/simple_types.tcc"

#include <thrift/lib/cpp2/gen/module_types_cpp.h>

#include "thrift/compiler/test/fixtures/lazy_deserialization/gen-cpp2/simple_data.h"
[[maybe_unused]] static constexpr std::string_view kModuleName = "simple";


namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::Foo>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::Foo>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view Foo::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<Foo>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view Foo::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<Foo>::name;
}

Foo::Foo(const Foo&) = default;
Foo& Foo::operator=(const Foo&) = default;
Foo::Foo() {
}


Foo::~Foo() {}

Foo::Foo([[maybe_unused]] Foo&& other) noexcept :
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __isset(other.__isset) {
}

Foo& Foo::operator=([[maybe_unused]] Foo&& other) noexcept {
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    __isset = other.__isset;
    return *this;
}


Foo::Foo(apache::thrift::FragileConstructor, ::std::vector<double> field1__arg, ::std::vector<::std::int32_t> field2__arg, ::std::vector<double> field3__arg, ::std::vector<::std::int32_t> field4__arg) :
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)) { 
  __isset.set(folly::index_constant<0>(), true);
  __isset.set(folly::index_constant<1>(), true);
  __isset.set(folly::index_constant<2>(), true);
  __isset.set(folly::index_constant<3>(), true);
}


void Foo::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_field1.clear();
  this->__fbthrift_field_field2.clear();
  this->__fbthrift_field_field3.clear();
  this->__fbthrift_field_field4.clear();
  __isset = {};
}

void Foo::__fbthrift_clear_terse_fields() {
}

bool Foo::__fbthrift_is_empty() const {
  return false;
}

bool Foo::operator==([[maybe_unused]] const Foo& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool Foo::operator<([[maybe_unused]] const Foo& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}

const ::std::vector<double>& Foo::get_field1() const& {
  return __fbthrift_field_field1;
}

::std::vector<double> Foo::get_field1() && {
  return std::move(__fbthrift_field_field1);
}

const ::std::vector<::std::int32_t>& Foo::get_field2() const& {
  return __fbthrift_field_field2;
}

::std::vector<::std::int32_t> Foo::get_field2() && {
  return std::move(__fbthrift_field_field2);
}

const ::std::vector<double>& Foo::get_field3() const& {
  return __fbthrift_field_field3;
}

::std::vector<double> Foo::get_field3() && {
  return std::move(__fbthrift_field_field3);
}

const ::std::vector<::std::int32_t>& Foo::get_field4() const& {
  return __fbthrift_field_field4;
}

::std::vector<::std::int32_t> Foo::get_field4() && {
  return std::move(__fbthrift_field_field4);
}


void swap([[maybe_unused]] Foo& a, [[maybe_unused]] Foo& b) {
  using ::std::swap;
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  swap(a.__isset, b.__isset);
}

template void Foo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t Foo::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t Foo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t Foo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void Foo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t Foo::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t Foo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t Foo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::LazyFoo>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::LazyFoo>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view LazyFoo::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<LazyFoo>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view LazyFoo::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<LazyFoo>::name;
}

LazyFoo::LazyFoo(const LazyFoo& srcObj) :
    __fbthrift_field_field1(srcObj.__fbthrift_field_field1),
    __fbthrift_field_field2(srcObj.__fbthrift_field_field2),
    __fbthrift_field_field3(srcObj.__fbthrift_field_field3),
    __fbthrift_field_field4(srcObj.__fbthrift_field_field4),
    __isset(srcObj.__isset) {
  const auto relaxed = std::memory_order_relaxed;
  auto lock = std::shared_lock(srcObj.__fbthrift_deserializationMutex_);
  __fbthrift_protocol_ = srcObj.__fbthrift_protocol_;
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field3 = srcObj.__fbthrift_serializedData_.field3;
  }
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    if (const auto& src = srcObj.__fbthrift_serializedData_.field4) {
      __fbthrift_serializedData_.field4 = src->clone();
    }
  }
}

static void __fbthrift_swap(LazyFoo& lhs, LazyFoo& rhs) { swap(lhs, rhs); }
LazyFoo& LazyFoo::operator=(const LazyFoo& other) {
  LazyFoo tmp(other);
  __fbthrift_swap(*this, tmp);
  return *this;
}

LazyFoo::LazyFoo() {
}


LazyFoo::~LazyFoo() {}

LazyFoo::LazyFoo([[maybe_unused]] LazyFoo&& other) noexcept :
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __isset(other.__isset),
    __fbthrift_serializedData_(std::move(other.__fbthrift_serializedData_)),
    __fbthrift_protocol_(other.__fbthrift_protocol_) {
  const auto relaxed = std::memory_order_relaxed;
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
}

LazyFoo& LazyFoo::operator=([[maybe_unused]] LazyFoo&& other) noexcept {
    const auto relaxed = std::memory_order_relaxed;
    __fbthrift_protocol_ = other.__fbthrift_protocol_;
    __fbthrift_serializedData_ = std::move(other.__fbthrift_serializedData_);
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
      __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
      __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    __isset = other.__isset;
    return *this;
}


LazyFoo::LazyFoo(apache::thrift::FragileConstructor, ::std::vector<double> field1__arg, ::std::vector<::std::int32_t> field2__arg, ::std::vector<double> field3__arg, ::std::vector<::std::int32_t> field4__arg) :
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)) { 
  __isset.set(folly::index_constant<0>(), true);
  __isset.set(folly::index_constant<1>(), true);
  __isset.set(folly::index_constant<2>(), true);
  __isset.set(folly::index_constant<3>(), true);
}

const ::std::vector<double>& LazyFoo::__fbthrift_read_field_field3() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  }
  return __fbthrift_field_field3;
}

::std::vector<double>& LazyFoo::__fbthrift_read_field_field3() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field3;
}

void LazyFoo::__fbthrift_read_field_field3_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field3 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field3 = {};
  __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}

const ::std::vector<::std::int32_t>& LazyFoo::__fbthrift_read_field_field4() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  }
  return __fbthrift_field_field4;
}

::std::vector<::std::int32_t>& LazyFoo::__fbthrift_read_field_field4() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field4;
}

void LazyFoo::__fbthrift_read_field_field4_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field4 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field4 = {};
  __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}


void LazyFoo::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_field1.clear();
  this->__fbthrift_field_field2.clear();
  this->__fbthrift_field_field3.clear();
  this->__fbthrift_field_field4.clear();
  __fbthrift_serializedData_ = {};
  __fbthrift_isDeserialized_.~__fbthrift_IsDeserialized();
  new (&__fbthrift_isDeserialized_) __fbthrift_IsDeserialized();
  __isset = {};
}

void LazyFoo::__fbthrift_clear_terse_fields() {
}

bool LazyFoo::__fbthrift_is_empty() const {
  return false;
}

bool LazyFoo::operator==([[maybe_unused]] const LazyFoo& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool LazyFoo::operator<([[maybe_unused]] const LazyFoo& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}

const ::std::vector<double>& LazyFoo::get_field1() const& {
  return __fbthrift_field_field1;
}

::std::vector<double> LazyFoo::get_field1() && {
  return std::move(__fbthrift_field_field1);
}

const ::std::vector<::std::int32_t>& LazyFoo::get_field2() const& {
  return __fbthrift_field_field2;
}

::std::vector<::std::int32_t> LazyFoo::get_field2() && {
  return std::move(__fbthrift_field_field2);
}


void swap([[maybe_unused]] LazyFoo& a, [[maybe_unused]] LazyFoo& b) {
  using ::std::swap;
  const auto relaxed = std::memory_order_relaxed;
  swap(a.__fbthrift_protocol_, b.__fbthrift_protocol_);
  swap(a.__fbthrift_serializedData_, b.__fbthrift_serializedData_);
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  a.__fbthrift_isDeserialized_.field3.store(b.__fbthrift_isDeserialized_.field3.exchange(a.__fbthrift_isDeserialized_.field3.load(relaxed), relaxed), relaxed);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  a.__fbthrift_isDeserialized_.field4.store(b.__fbthrift_isDeserialized_.field4.exchange(a.__fbthrift_isDeserialized_.field4.load(relaxed), relaxed), relaxed);
  swap(a.__isset, b.__isset);
}

template void LazyFoo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t LazyFoo::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t LazyFoo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t LazyFoo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void LazyFoo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t LazyFoo::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t LazyFoo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t LazyFoo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::OptionalFoo>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::OptionalFoo>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view OptionalFoo::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<OptionalFoo>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view OptionalFoo::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<OptionalFoo>::name;
}

OptionalFoo::OptionalFoo(const OptionalFoo&) = default;
OptionalFoo& OptionalFoo::operator=(const OptionalFoo&) = default;
OptionalFoo::OptionalFoo() {
}


OptionalFoo::~OptionalFoo() {}

OptionalFoo::OptionalFoo([[maybe_unused]] OptionalFoo&& other) noexcept :
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __isset(other.__isset) {
}

OptionalFoo& OptionalFoo::operator=([[maybe_unused]] OptionalFoo&& other) noexcept {
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    __isset = other.__isset;
    return *this;
}


OptionalFoo::OptionalFoo(apache::thrift::FragileConstructor, ::std::vector<double> field1__arg, ::std::vector<::std::int32_t> field2__arg, ::std::vector<double> field3__arg, ::std::vector<::std::int32_t> field4__arg) :
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)) { 
  __isset.set(folly::index_constant<0>(), true);
  __isset.set(folly::index_constant<1>(), true);
  __isset.set(folly::index_constant<2>(), true);
  __isset.set(folly::index_constant<3>(), true);
}


void OptionalFoo::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_field1.clear();
  this->__fbthrift_field_field2.clear();
  this->__fbthrift_field_field3.clear();
  this->__fbthrift_field_field4.clear();
  __isset = {};
}

void OptionalFoo::__fbthrift_clear_terse_fields() {
}

bool OptionalFoo::__fbthrift_is_empty() const {
  return !(this->__isset.get(0)) &&
 !(this->__isset.get(1)) &&
 !(this->__isset.get(2)) &&
 !(this->__isset.get(3));
}

bool OptionalFoo::operator==([[maybe_unused]] const OptionalFoo& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool OptionalFoo::operator<([[maybe_unused]] const OptionalFoo& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}

const ::std::vector<double>* OptionalFoo::get_field1() const& {
  return field1_ref().has_value() ? std::addressof(__fbthrift_field_field1) : nullptr;
}

::std::vector<double>* OptionalFoo::get_field1() & {
  return field1_ref().has_value() ? std::addressof(__fbthrift_field_field1) : nullptr;
}

const ::std::vector<::std::int32_t>* OptionalFoo::get_field2() const& {
  return field2_ref().has_value() ? std::addressof(__fbthrift_field_field2) : nullptr;
}

::std::vector<::std::int32_t>* OptionalFoo::get_field2() & {
  return field2_ref().has_value() ? std::addressof(__fbthrift_field_field2) : nullptr;
}

const ::std::vector<double>* OptionalFoo::get_field3() const& {
  return field3_ref().has_value() ? std::addressof(__fbthrift_field_field3) : nullptr;
}

::std::vector<double>* OptionalFoo::get_field3() & {
  return field3_ref().has_value() ? std::addressof(__fbthrift_field_field3) : nullptr;
}

const ::std::vector<::std::int32_t>* OptionalFoo::get_field4() const& {
  return field4_ref().has_value() ? std::addressof(__fbthrift_field_field4) : nullptr;
}

::std::vector<::std::int32_t>* OptionalFoo::get_field4() & {
  return field4_ref().has_value() ? std::addressof(__fbthrift_field_field4) : nullptr;
}


void swap([[maybe_unused]] OptionalFoo& a, [[maybe_unused]] OptionalFoo& b) {
  using ::std::swap;
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  swap(a.__isset, b.__isset);
}

template void OptionalFoo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t OptionalFoo::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t OptionalFoo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t OptionalFoo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void OptionalFoo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t OptionalFoo::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t OptionalFoo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t OptionalFoo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::OptionalLazyFoo>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::OptionalLazyFoo>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view OptionalLazyFoo::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<OptionalLazyFoo>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view OptionalLazyFoo::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<OptionalLazyFoo>::name;
}

OptionalLazyFoo::OptionalLazyFoo(const OptionalLazyFoo& srcObj) :
    __fbthrift_field_field1(srcObj.__fbthrift_field_field1),
    __fbthrift_field_field2(srcObj.__fbthrift_field_field2),
    __fbthrift_field_field3(srcObj.__fbthrift_field_field3),
    __fbthrift_field_field4(srcObj.__fbthrift_field_field4),
    __isset(srcObj.__isset) {
  const auto relaxed = std::memory_order_relaxed;
  auto lock = std::shared_lock(srcObj.__fbthrift_deserializationMutex_);
  __fbthrift_protocol_ = srcObj.__fbthrift_protocol_;
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field3 = srcObj.__fbthrift_serializedData_.field3;
  }
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field4 = srcObj.__fbthrift_serializedData_.field4;
  }
}

static void __fbthrift_swap(OptionalLazyFoo& lhs, OptionalLazyFoo& rhs) { swap(lhs, rhs); }
OptionalLazyFoo& OptionalLazyFoo::operator=(const OptionalLazyFoo& other) {
  OptionalLazyFoo tmp(other);
  __fbthrift_swap(*this, tmp);
  return *this;
}

OptionalLazyFoo::OptionalLazyFoo() {
}


OptionalLazyFoo::~OptionalLazyFoo() {}

OptionalLazyFoo::OptionalLazyFoo([[maybe_unused]] OptionalLazyFoo&& other) noexcept :
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __isset(other.__isset),
    __fbthrift_serializedData_(std::move(other.__fbthrift_serializedData_)),
    __fbthrift_protocol_(other.__fbthrift_protocol_) {
  const auto relaxed = std::memory_order_relaxed;
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
}

OptionalLazyFoo& OptionalLazyFoo::operator=([[maybe_unused]] OptionalLazyFoo&& other) noexcept {
    const auto relaxed = std::memory_order_relaxed;
    __fbthrift_protocol_ = other.__fbthrift_protocol_;
    __fbthrift_serializedData_ = std::move(other.__fbthrift_serializedData_);
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
      __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
      __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    __isset = other.__isset;
    return *this;
}


OptionalLazyFoo::OptionalLazyFoo(apache::thrift::FragileConstructor, ::std::vector<double> field1__arg, ::std::vector<::std::int32_t> field2__arg, ::std::vector<double> field3__arg, ::std::vector<::std::int32_t> field4__arg) :
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)) { 
  __isset.set(folly::index_constant<0>(), true);
  __isset.set(folly::index_constant<1>(), true);
  __isset.set(folly::index_constant<2>(), true);
  __isset.set(folly::index_constant<3>(), true);
}

const ::std::vector<double>& OptionalLazyFoo::__fbthrift_read_field_field3() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  }
  return __fbthrift_field_field3;
}

::std::vector<double>& OptionalLazyFoo::__fbthrift_read_field_field3() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field3;
}

void OptionalLazyFoo::__fbthrift_read_field_field3_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field3 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field3 = {};
  __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}

const ::std::vector<::std::int32_t>& OptionalLazyFoo::__fbthrift_read_field_field4() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  }
  return __fbthrift_field_field4;
}

::std::vector<::std::int32_t>& OptionalLazyFoo::__fbthrift_read_field_field4() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field4;
}

void OptionalLazyFoo::__fbthrift_read_field_field4_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field4 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field4 = {};
  __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}


void OptionalLazyFoo::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_field1.clear();
  this->__fbthrift_field_field2.clear();
  this->__fbthrift_field_field3.clear();
  this->__fbthrift_field_field4.clear();
  __fbthrift_serializedData_ = {};
  __fbthrift_isDeserialized_.~__fbthrift_IsDeserialized();
  new (&__fbthrift_isDeserialized_) __fbthrift_IsDeserialized();
  __isset = {};
}

void OptionalLazyFoo::__fbthrift_clear_terse_fields() {
}

bool OptionalLazyFoo::__fbthrift_is_empty() const {
  return !(this->__isset.get(0)) &&
 !(this->__isset.get(1)) &&
 !(this->__isset.get(2)) &&
 !(this->__isset.get(3));
}

bool OptionalLazyFoo::operator==([[maybe_unused]] const OptionalLazyFoo& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool OptionalLazyFoo::operator<([[maybe_unused]] const OptionalLazyFoo& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}

const ::std::vector<double>* OptionalLazyFoo::get_field1() const& {
  return field1_ref().has_value() ? std::addressof(__fbthrift_field_field1) : nullptr;
}

::std::vector<double>* OptionalLazyFoo::get_field1() & {
  return field1_ref().has_value() ? std::addressof(__fbthrift_field_field1) : nullptr;
}

const ::std::vector<::std::int32_t>* OptionalLazyFoo::get_field2() const& {
  return field2_ref().has_value() ? std::addressof(__fbthrift_field_field2) : nullptr;
}

::std::vector<::std::int32_t>* OptionalLazyFoo::get_field2() & {
  return field2_ref().has_value() ? std::addressof(__fbthrift_field_field2) : nullptr;
}


void swap([[maybe_unused]] OptionalLazyFoo& a, [[maybe_unused]] OptionalLazyFoo& b) {
  using ::std::swap;
  const auto relaxed = std::memory_order_relaxed;
  swap(a.__fbthrift_protocol_, b.__fbthrift_protocol_);
  swap(a.__fbthrift_serializedData_, b.__fbthrift_serializedData_);
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  a.__fbthrift_isDeserialized_.field3.store(b.__fbthrift_isDeserialized_.field3.exchange(a.__fbthrift_isDeserialized_.field3.load(relaxed), relaxed), relaxed);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  a.__fbthrift_isDeserialized_.field4.store(b.__fbthrift_isDeserialized_.field4.exchange(a.__fbthrift_isDeserialized_.field4.load(relaxed), relaxed), relaxed);
  swap(a.__isset, b.__isset);
}

template void OptionalLazyFoo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t OptionalLazyFoo::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t OptionalLazyFoo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t OptionalLazyFoo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void OptionalLazyFoo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t OptionalLazyFoo::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t OptionalLazyFoo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t OptionalLazyFoo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::OptionalBoxedLazyFoo>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::OptionalBoxedLazyFoo>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view OptionalBoxedLazyFoo::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<OptionalBoxedLazyFoo>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view OptionalBoxedLazyFoo::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<OptionalBoxedLazyFoo>::name;
}

OptionalBoxedLazyFoo::OptionalBoxedLazyFoo(const OptionalBoxedLazyFoo& srcObj) :
    __fbthrift_field_field1(srcObj.__fbthrift_field_field1),
    __fbthrift_field_field2(srcObj.__fbthrift_field_field2),
    __fbthrift_field_field3(srcObj.__fbthrift_field_field3),
    __fbthrift_field_field4(srcObj.__fbthrift_field_field4) {
  const auto relaxed = std::memory_order_relaxed;
  auto lock = std::shared_lock(srcObj.__fbthrift_deserializationMutex_);
  __fbthrift_protocol_ = srcObj.__fbthrift_protocol_;
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field3 = srcObj.__fbthrift_serializedData_.field3;
  }
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field4 = srcObj.__fbthrift_serializedData_.field4;
  }
}

static void __fbthrift_swap(OptionalBoxedLazyFoo& lhs, OptionalBoxedLazyFoo& rhs) { swap(lhs, rhs); }
OptionalBoxedLazyFoo& OptionalBoxedLazyFoo::operator=(const OptionalBoxedLazyFoo& other) {
  OptionalBoxedLazyFoo tmp(other);
  __fbthrift_swap(*this, tmp);
  return *this;
}

OptionalBoxedLazyFoo::OptionalBoxedLazyFoo() {
}


OptionalBoxedLazyFoo::~OptionalBoxedLazyFoo() {}

OptionalBoxedLazyFoo::OptionalBoxedLazyFoo([[maybe_unused]] OptionalBoxedLazyFoo&& other) noexcept :
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __fbthrift_serializedData_(std::move(other.__fbthrift_serializedData_)),
    __fbthrift_protocol_(other.__fbthrift_protocol_) {
  const auto relaxed = std::memory_order_relaxed;
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
}

OptionalBoxedLazyFoo& OptionalBoxedLazyFoo::operator=([[maybe_unused]] OptionalBoxedLazyFoo&& other) noexcept {
    const auto relaxed = std::memory_order_relaxed;
    __fbthrift_protocol_ = other.__fbthrift_protocol_;
    __fbthrift_serializedData_ = std::move(other.__fbthrift_serializedData_);
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
      __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
      __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    return *this;
}


OptionalBoxedLazyFoo::OptionalBoxedLazyFoo(apache::thrift::FragileConstructor, ::apache::thrift::detail::boxed_value_ptr<::std::vector<double>> field1__arg, ::apache::thrift::detail::boxed_value_ptr<::std::vector<::std::int32_t>> field2__arg, ::apache::thrift::detail::boxed_value_ptr<::std::vector<double>> field3__arg, ::apache::thrift::detail::boxed_value_ptr<::std::vector<::std::int32_t>> field4__arg) :
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)) { 
}

const ::apache::thrift::detail::boxed_value_ptr<::std::vector<double>>& OptionalBoxedLazyFoo::__fbthrift_read_field_field3() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  }
  return __fbthrift_field_field3;
}

::apache::thrift::detail::boxed_value_ptr<::std::vector<double>>& OptionalBoxedLazyFoo::__fbthrift_read_field_field3() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field3;
}

void OptionalBoxedLazyFoo::__fbthrift_read_field_field3_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field3 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field3 = {};
  __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}

const ::apache::thrift::detail::boxed_value_ptr<::std::vector<::std::int32_t>>& OptionalBoxedLazyFoo::__fbthrift_read_field_field4() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  }
  return __fbthrift_field_field4;
}

::apache::thrift::detail::boxed_value_ptr<::std::vector<::std::int32_t>>& OptionalBoxedLazyFoo::__fbthrift_read_field_field4() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field4;
}

void OptionalBoxedLazyFoo::__fbthrift_read_field_field4_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field4 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field4 = {};
  __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}


void OptionalBoxedLazyFoo::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_field1.reset();
  this->__fbthrift_field_field2.reset();
  this->__fbthrift_field_field3.reset();
  this->__fbthrift_field_field4.reset();
  __fbthrift_serializedData_ = {};
  __fbthrift_isDeserialized_.~__fbthrift_IsDeserialized();
  new (&__fbthrift_isDeserialized_) __fbthrift_IsDeserialized();
}

void OptionalBoxedLazyFoo::__fbthrift_clear_terse_fields() {
}

bool OptionalBoxedLazyFoo::__fbthrift_is_empty() const {
  return !(this->__fbthrift_field_field1) &&
 !(this->__fbthrift_field_field2) &&
 !(!(__fbthrift_isDeserialized_.field3 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) ||
    this->__fbthrift_field_field3) &&
 !(!(__fbthrift_isDeserialized_.field4 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) ||
    this->__fbthrift_field_field4);
}

bool OptionalBoxedLazyFoo::operator==([[maybe_unused]] const OptionalBoxedLazyFoo& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool OptionalBoxedLazyFoo::operator<([[maybe_unused]] const OptionalBoxedLazyFoo& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}


void swap([[maybe_unused]] OptionalBoxedLazyFoo& a, [[maybe_unused]] OptionalBoxedLazyFoo& b) {
  using ::std::swap;
  const auto relaxed = std::memory_order_relaxed;
  swap(a.__fbthrift_protocol_, b.__fbthrift_protocol_);
  swap(a.__fbthrift_serializedData_, b.__fbthrift_serializedData_);
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  a.__fbthrift_isDeserialized_.field3.store(b.__fbthrift_isDeserialized_.field3.exchange(a.__fbthrift_isDeserialized_.field3.load(relaxed), relaxed), relaxed);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  a.__fbthrift_isDeserialized_.field4.store(b.__fbthrift_isDeserialized_.field4.exchange(a.__fbthrift_isDeserialized_.field4.load(relaxed), relaxed), relaxed);
}

template void OptionalBoxedLazyFoo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t OptionalBoxedLazyFoo::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t OptionalBoxedLazyFoo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t OptionalBoxedLazyFoo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void OptionalBoxedLazyFoo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t OptionalBoxedLazyFoo::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t OptionalBoxedLazyFoo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t OptionalBoxedLazyFoo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::LazyCppRef>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::LazyCppRef>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view LazyCppRef::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<LazyCppRef>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view LazyCppRef::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<LazyCppRef>::name;
}

LazyCppRef::LazyCppRef(const LazyCppRef& srcObj) :
    __fbthrift_field_field1(::apache::thrift::detail::st::copy_field<
          ::apache::thrift::type_class::list<::apache::thrift::type_class::integral>>(srcObj.__fbthrift_field_field1)),
    __fbthrift_field_field2(srcObj.__fbthrift_field_field2),
    __fbthrift_field_field3(srcObj.__fbthrift_field_field3),
    __fbthrift_field_field4(::apache::thrift::detail::st::copy_field<
          ::apache::thrift::type_class::list<::apache::thrift::type_class::integral>>(srcObj.__fbthrift_field_field4)) {
  const auto relaxed = std::memory_order_relaxed;
  auto lock = std::shared_lock(srcObj.__fbthrift_deserializationMutex_);
  __fbthrift_protocol_ = srcObj.__fbthrift_protocol_;
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field1.load(relaxed);
    __fbthrift_isDeserialized_.field1.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field1 = srcObj.__fbthrift_serializedData_.field1;
  }
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field2.load(relaxed);
    __fbthrift_isDeserialized_.field2.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field2 = srcObj.__fbthrift_serializedData_.field2;
  }
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field3 = srcObj.__fbthrift_serializedData_.field3;
  }
  {
    const auto isDeserialized = srcObj.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    __fbthrift_serializedData_.field4 = srcObj.__fbthrift_serializedData_.field4;
  }
}

static void __fbthrift_swap(LazyCppRef& lhs, LazyCppRef& rhs) { swap(lhs, rhs); }
LazyCppRef& LazyCppRef::operator=(const LazyCppRef& other) {
  LazyCppRef tmp(other);
  __fbthrift_swap(*this, tmp);
  return *this;
}

LazyCppRef::LazyCppRef() :
    __fbthrift_field_field4(std::make_unique<::std::vector<::std::int32_t>>()) {
}


LazyCppRef::~LazyCppRef() {}

LazyCppRef::LazyCppRef([[maybe_unused]] LazyCppRef&& other) noexcept :
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __fbthrift_serializedData_(std::move(other.__fbthrift_serializedData_)),
    __fbthrift_protocol_(other.__fbthrift_protocol_) {
  const auto relaxed = std::memory_order_relaxed;
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field1.load(relaxed);
    __fbthrift_isDeserialized_.field1.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field1.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field2.load(relaxed);
    __fbthrift_isDeserialized_.field2.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field2.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
    __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
  {
    const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
    __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
    other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
  }
}

LazyCppRef& LazyCppRef::operator=([[maybe_unused]] LazyCppRef&& other) noexcept {
    const auto relaxed = std::memory_order_relaxed;
    __fbthrift_protocol_ = other.__fbthrift_protocol_;
    __fbthrift_serializedData_ = std::move(other.__fbthrift_serializedData_);
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field1.load(relaxed);
      __fbthrift_isDeserialized_.field1.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field1.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field2.load(relaxed);
      __fbthrift_isDeserialized_.field2.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field2.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field3.load(relaxed);
      __fbthrift_isDeserialized_.field3.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field3.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    {
      const auto isDeserialized = other.__fbthrift_isDeserialized_.field4.load(relaxed);
      __fbthrift_isDeserialized_.field4.store(isDeserialized, relaxed);
      other.__fbthrift_isDeserialized_.field4.store(isDeserialized | ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED, relaxed);
    }
    return *this;
}


LazyCppRef::LazyCppRef(apache::thrift::FragileConstructor, ::std::unique_ptr<::std::vector<::std::int32_t>> field1__arg, ::std::shared_ptr<::std::vector<::std::int32_t>> field2__arg, ::std::shared_ptr<const ::std::vector<::std::int32_t>> field3__arg, ::std::unique_ptr<::std::vector<::std::int32_t>> field4__arg) :
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)) { 
}

const ::std::unique_ptr<::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field1() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field1.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field1_slow();
  }
  return __fbthrift_field_field1;
}

::std::unique_ptr<::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field1() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field1.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field1_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field1 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field1;
}

void LazyCppRef::__fbthrift_read_field_field1_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field1 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field1_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field1_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field1 = {};
  __fbthrift_isDeserialized_.field1 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}

const ::std::shared_ptr<::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field2() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field2.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field2_slow();
  }
  return __fbthrift_field_field2;
}

::std::shared_ptr<::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field2() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field2.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field2_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field2 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field2;
}

void LazyCppRef::__fbthrift_read_field_field2_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field2 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field2_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field2_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field2 = {};
  __fbthrift_isDeserialized_.field2 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}

const ::std::shared_ptr<const ::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field3() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  }
  return __fbthrift_field_field3;
}

::std::shared_ptr<const ::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field3() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field3.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field3_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field3;
}

void LazyCppRef::__fbthrift_read_field_field3_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field3 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field3_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field3 = {};
  __fbthrift_isDeserialized_.field3 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}

const ::std::unique_ptr<::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field4() const {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  }
  return __fbthrift_field_field4;
}

::std::unique_ptr<::std::vector<::std::int32_t>>& LazyCppRef::__fbthrift_read_field_field4() {
  const auto isDeserialized = __fbthrift_isDeserialized_.field4.load(std::memory_order_relaxed);
  if (!(isDeserialized & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED)) {
    __fbthrift_read_field_field4_slow();
  } else if (isDeserialized & ::apache::thrift::detail::LazyDeserializationState::UNTAINTED) {
    __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
  }
  return __fbthrift_field_field4;
}

void LazyCppRef::__fbthrift_read_field_field4_slow() const {
  auto lock = std::unique_lock(__fbthrift_deserializationMutex_);
  if (__fbthrift_isDeserialized_.field4 & ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED) {
    return;
  }
  switch (__fbthrift_protocol_) {
    case ::apache::thrift::protocol::T_COMPACT_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::CompactProtocolReader>();
      break;
    case ::apache::thrift::protocol::T_BINARY_PROTOCOL:
      __fbthrift_read_field_field4_impl<::apache::thrift::BinaryProtocolReader>();
      break;
    default:
      CHECK(false) << int(__fbthrift_protocol_);
  }
  __fbthrift_serializedData_.field4 = {};
  __fbthrift_isDeserialized_.field4 = ::apache::thrift::detail::LazyDeserializationState::DESERIALIZED;
}


void LazyCppRef::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_field1.reset();
  this->__fbthrift_field_field2.reset();
  this->__fbthrift_field_field3.reset();
  this->__fbthrift_field_field4 = ::apache::thrift::detail::make_mutable_smart_ptr<::std::unique_ptr<::std::vector<::std::int32_t>>>();
  __fbthrift_serializedData_ = {};
  __fbthrift_isDeserialized_.~__fbthrift_IsDeserialized();
  new (&__fbthrift_isDeserialized_) __fbthrift_IsDeserialized();
}

void LazyCppRef::__fbthrift_clear_terse_fields() {
}

bool LazyCppRef::__fbthrift_is_empty() const {
  return false;
}

bool LazyCppRef::operator==([[maybe_unused]] const LazyCppRef& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool LazyCppRef::operator<([[maybe_unused]] const LazyCppRef& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}


void swap([[maybe_unused]] LazyCppRef& a, [[maybe_unused]] LazyCppRef& b) {
  using ::std::swap;
  const auto relaxed = std::memory_order_relaxed;
  swap(a.__fbthrift_protocol_, b.__fbthrift_protocol_);
  swap(a.__fbthrift_serializedData_, b.__fbthrift_serializedData_);
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  a.__fbthrift_isDeserialized_.field1.store(b.__fbthrift_isDeserialized_.field1.exchange(a.__fbthrift_isDeserialized_.field1.load(relaxed), relaxed), relaxed);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  a.__fbthrift_isDeserialized_.field2.store(b.__fbthrift_isDeserialized_.field2.exchange(a.__fbthrift_isDeserialized_.field2.load(relaxed), relaxed), relaxed);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  a.__fbthrift_isDeserialized_.field3.store(b.__fbthrift_isDeserialized_.field3.exchange(a.__fbthrift_isDeserialized_.field3.load(relaxed), relaxed), relaxed);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  a.__fbthrift_isDeserialized_.field4.store(b.__fbthrift_isDeserialized_.field4.exchange(a.__fbthrift_isDeserialized_.field4.load(relaxed), relaxed), relaxed);
}

template void LazyCppRef::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t LazyCppRef::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t LazyCppRef::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t LazyCppRef::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void LazyCppRef::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t LazyCppRef::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t LazyCppRef::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t LazyCppRef::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::IndexedFoo>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::IndexedFoo>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view IndexedFoo::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<IndexedFoo>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view IndexedFoo::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<IndexedFoo>::name;
}

IndexedFoo::IndexedFoo(const IndexedFoo&) = default;
IndexedFoo& IndexedFoo::operator=(const IndexedFoo&) = default;
IndexedFoo::IndexedFoo() :
    __fbthrift_field_serialized_data_size() {
}


IndexedFoo::~IndexedFoo() {}

IndexedFoo::IndexedFoo([[maybe_unused]] IndexedFoo&& other) noexcept :
    __fbthrift_field_serialized_data_size(std::move(other.__fbthrift_field_serialized_data_size)),
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __fbthrift_field_field_id_to_size(std::move(other.__fbthrift_field_field_id_to_size)),
    __isset(other.__isset) {
}

IndexedFoo& IndexedFoo::operator=([[maybe_unused]] IndexedFoo&& other) noexcept {
    this->__fbthrift_field_serialized_data_size = std::move(other.__fbthrift_field_serialized_data_size);
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    this->__fbthrift_field_field_id_to_size = std::move(other.__fbthrift_field_field_id_to_size);
    __isset = other.__isset;
    return *this;
}


IndexedFoo::IndexedFoo(apache::thrift::FragileConstructor, double serialized_data_size__arg, ::std::vector<double> field1__arg, ::std::vector<::std::int32_t> field2__arg, ::std::vector<double> field3__arg, ::std::vector<::std::int32_t> field4__arg, ::std::map<::std::int16_t, ::std::int64_t> field_id_to_size__arg) :
    __fbthrift_field_serialized_data_size(std::move(serialized_data_size__arg)),
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)),
    __fbthrift_field_field_id_to_size(std::move(field_id_to_size__arg)) { 
  __isset.set(folly::index_constant<0>(), true);
  __isset.set(folly::index_constant<1>(), true);
  __isset.set(folly::index_constant<2>(), true);
  __isset.set(folly::index_constant<3>(), true);
  __isset.set(folly::index_constant<4>(), true);
  __isset.set(folly::index_constant<5>(), true);
}


void IndexedFoo::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_serialized_data_size = double();
  this->__fbthrift_field_field1.clear();
  this->__fbthrift_field_field2.clear();
  this->__fbthrift_field_field3.clear();
  this->__fbthrift_field_field4.clear();
  this->__fbthrift_field_field_id_to_size.clear();
  __isset = {};
}

void IndexedFoo::__fbthrift_clear_terse_fields() {
}

bool IndexedFoo::__fbthrift_is_empty() const {
  return false;
}

bool IndexedFoo::operator==([[maybe_unused]] const IndexedFoo& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool IndexedFoo::operator<([[maybe_unused]] const IndexedFoo& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}

const ::std::vector<double>& IndexedFoo::get_field1() const& {
  return __fbthrift_field_field1;
}

::std::vector<double> IndexedFoo::get_field1() && {
  return std::move(__fbthrift_field_field1);
}

const ::std::vector<::std::int32_t>& IndexedFoo::get_field2() const& {
  return __fbthrift_field_field2;
}

::std::vector<::std::int32_t> IndexedFoo::get_field2() && {
  return std::move(__fbthrift_field_field2);
}

const ::std::vector<double>& IndexedFoo::get_field3() const& {
  return __fbthrift_field_field3;
}

::std::vector<double> IndexedFoo::get_field3() && {
  return std::move(__fbthrift_field_field3);
}

const ::std::vector<::std::int32_t>& IndexedFoo::get_field4() const& {
  return __fbthrift_field_field4;
}

::std::vector<::std::int32_t> IndexedFoo::get_field4() && {
  return std::move(__fbthrift_field_field4);
}

const ::std::map<::std::int16_t, ::std::int64_t>& IndexedFoo::get_field_id_to_size() const& {
  return __fbthrift_field_field_id_to_size;
}

::std::map<::std::int16_t, ::std::int64_t> IndexedFoo::get_field_id_to_size() && {
  return std::move(__fbthrift_field_field_id_to_size);
}


void swap([[maybe_unused]] IndexedFoo& a, [[maybe_unused]] IndexedFoo& b) {
  using ::std::swap;
  swap(a.__fbthrift_field_serialized_data_size, b.__fbthrift_field_serialized_data_size);
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  swap(a.__fbthrift_field_field_id_to_size, b.__fbthrift_field_field_id_to_size);
  swap(a.__isset, b.__isset);
}

template void IndexedFoo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t IndexedFoo::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t IndexedFoo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t IndexedFoo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void IndexedFoo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t IndexedFoo::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t IndexedFoo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t IndexedFoo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::OptionalIndexedFoo>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::OptionalIndexedFoo>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view OptionalIndexedFoo::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<OptionalIndexedFoo>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view OptionalIndexedFoo::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<OptionalIndexedFoo>::name;
}

OptionalIndexedFoo::OptionalIndexedFoo(const OptionalIndexedFoo&) = default;
OptionalIndexedFoo& OptionalIndexedFoo::operator=(const OptionalIndexedFoo&) = default;
OptionalIndexedFoo::OptionalIndexedFoo() :
    __fbthrift_field_serialized_data_size() {
}


OptionalIndexedFoo::~OptionalIndexedFoo() {}

OptionalIndexedFoo::OptionalIndexedFoo([[maybe_unused]] OptionalIndexedFoo&& other) noexcept :
    __fbthrift_field_serialized_data_size(std::move(other.__fbthrift_field_serialized_data_size)),
    __fbthrift_field_field1(std::move(other.__fbthrift_field_field1)),
    __fbthrift_field_field2(std::move(other.__fbthrift_field_field2)),
    __fbthrift_field_field3(std::move(other.__fbthrift_field_field3)),
    __fbthrift_field_field4(std::move(other.__fbthrift_field_field4)),
    __fbthrift_field_field_id_to_size(std::move(other.__fbthrift_field_field_id_to_size)),
    __isset(other.__isset) {
}

OptionalIndexedFoo& OptionalIndexedFoo::operator=([[maybe_unused]] OptionalIndexedFoo&& other) noexcept {
    this->__fbthrift_field_serialized_data_size = std::move(other.__fbthrift_field_serialized_data_size);
    this->__fbthrift_field_field1 = std::move(other.__fbthrift_field_field1);
    this->__fbthrift_field_field2 = std::move(other.__fbthrift_field_field2);
    this->__fbthrift_field_field3 = std::move(other.__fbthrift_field_field3);
    this->__fbthrift_field_field4 = std::move(other.__fbthrift_field_field4);
    this->__fbthrift_field_field_id_to_size = std::move(other.__fbthrift_field_field_id_to_size);
    __isset = other.__isset;
    return *this;
}


OptionalIndexedFoo::OptionalIndexedFoo(apache::thrift::FragileConstructor, double serialized_data_size__arg, ::std::vector<double> field1__arg, ::std::vector<::std::int32_t> field2__arg, ::std::vector<double> field3__arg, ::std::vector<::std::int32_t> field4__arg, ::std::map<::std::int16_t, ::std::int64_t> field_id_to_size__arg) :
    __fbthrift_field_serialized_data_size(std::move(serialized_data_size__arg)),
    __fbthrift_field_field1(std::move(field1__arg)),
    __fbthrift_field_field2(std::move(field2__arg)),
    __fbthrift_field_field3(std::move(field3__arg)),
    __fbthrift_field_field4(std::move(field4__arg)),
    __fbthrift_field_field_id_to_size(std::move(field_id_to_size__arg)) { 
  __isset.set(folly::index_constant<0>(), true);
  __isset.set(folly::index_constant<1>(), true);
  __isset.set(folly::index_constant<2>(), true);
  __isset.set(folly::index_constant<3>(), true);
  __isset.set(folly::index_constant<4>(), true);
  __isset.set(folly::index_constant<5>(), true);
}


void OptionalIndexedFoo::__fbthrift_clear() {
  // clear all fields
  this->__fbthrift_field_serialized_data_size = double();
  this->__fbthrift_field_field1.clear();
  this->__fbthrift_field_field2.clear();
  this->__fbthrift_field_field3.clear();
  this->__fbthrift_field_field4.clear();
  this->__fbthrift_field_field_id_to_size.clear();
  __isset = {};
}

void OptionalIndexedFoo::__fbthrift_clear_terse_fields() {
}

bool OptionalIndexedFoo::__fbthrift_is_empty() const {
  return false;
}

bool OptionalIndexedFoo::operator==([[maybe_unused]] const OptionalIndexedFoo& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool OptionalIndexedFoo::operator<([[maybe_unused]] const OptionalIndexedFoo& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}

const ::std::vector<double>* OptionalIndexedFoo::get_field1() const& {
  return field1_ref().has_value() ? std::addressof(__fbthrift_field_field1) : nullptr;
}

::std::vector<double>* OptionalIndexedFoo::get_field1() & {
  return field1_ref().has_value() ? std::addressof(__fbthrift_field_field1) : nullptr;
}

const ::std::vector<::std::int32_t>* OptionalIndexedFoo::get_field2() const& {
  return field2_ref().has_value() ? std::addressof(__fbthrift_field_field2) : nullptr;
}

::std::vector<::std::int32_t>* OptionalIndexedFoo::get_field2() & {
  return field2_ref().has_value() ? std::addressof(__fbthrift_field_field2) : nullptr;
}

const ::std::vector<double>* OptionalIndexedFoo::get_field3() const& {
  return field3_ref().has_value() ? std::addressof(__fbthrift_field_field3) : nullptr;
}

::std::vector<double>* OptionalIndexedFoo::get_field3() & {
  return field3_ref().has_value() ? std::addressof(__fbthrift_field_field3) : nullptr;
}

const ::std::vector<::std::int32_t>* OptionalIndexedFoo::get_field4() const& {
  return field4_ref().has_value() ? std::addressof(__fbthrift_field_field4) : nullptr;
}

::std::vector<::std::int32_t>* OptionalIndexedFoo::get_field4() & {
  return field4_ref().has_value() ? std::addressof(__fbthrift_field_field4) : nullptr;
}

const ::std::map<::std::int16_t, ::std::int64_t>& OptionalIndexedFoo::get_field_id_to_size() const& {
  return __fbthrift_field_field_id_to_size;
}

::std::map<::std::int16_t, ::std::int64_t> OptionalIndexedFoo::get_field_id_to_size() && {
  return std::move(__fbthrift_field_field_id_to_size);
}


void swap([[maybe_unused]] OptionalIndexedFoo& a, [[maybe_unused]] OptionalIndexedFoo& b) {
  using ::std::swap;
  swap(a.__fbthrift_field_serialized_data_size, b.__fbthrift_field_serialized_data_size);
  swap(a.__fbthrift_field_field1, b.__fbthrift_field_field1);
  swap(a.__fbthrift_field_field2, b.__fbthrift_field_field2);
  swap(a.__fbthrift_field_field3, b.__fbthrift_field_field3);
  swap(a.__fbthrift_field_field4, b.__fbthrift_field_field4);
  swap(a.__fbthrift_field_field_id_to_size, b.__fbthrift_field_field_id_to_size);
  swap(a.__isset, b.__isset);
}

template void OptionalIndexedFoo::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t OptionalIndexedFoo::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t OptionalIndexedFoo::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t OptionalIndexedFoo::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void OptionalIndexedFoo::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t OptionalIndexedFoo::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t OptionalIndexedFoo::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t OptionalIndexedFoo::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache {
namespace thrift {
namespace detail {

void TccStructTraits<::apache::thrift::test::Empty>::translateFieldName(
    std::string_view _fname,
    int16_t& fid,
    apache::thrift::protocol::TType& _ftype) noexcept {
  using data = apache::thrift::TStructDataStorage<::apache::thrift::test::Empty>;
  static const st::translate_field_name_table table{
      data::fields_size,
      data::fields_names.data(),
      data::fields_ids.data(),
      data::fields_types.data()};
  st::translate_field_name(_fname, fid, _ftype, table);
}

} // namespace detail
} // namespace thrift
} // namespace apache

namespace apache::thrift::test {

std::string_view Empty::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) {
  if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; }
  return apache::thrift::TStructDataStorage<Empty>::fields_names[folly::to_underlying(ord) - 1];
}
std::string_view Empty::__fbthrift_get_class_name() {
  return apache::thrift::TStructDataStorage<Empty>::name;
}


Empty::Empty(apache::thrift::FragileConstructor) {}


void Empty::__fbthrift_clear() {
  // clear all fields
}

void Empty::__fbthrift_clear_terse_fields() {
}

bool Empty::__fbthrift_is_empty() const {
  return true;
}

bool Empty::operator==([[maybe_unused]] const Empty& rhs) const {
  return ::apache::thrift::op::detail::StructEquality{}(*this, rhs);
}

bool Empty::operator<([[maybe_unused]] const Empty& rhs) const {
  return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs);
}


void swap([[maybe_unused]] Empty& a, [[maybe_unused]] Empty& b) {
  using ::std::swap;
}

template void Empty::readNoXfer<>(apache::thrift::BinaryProtocolReader*);
template uint32_t Empty::write<>(apache::thrift::BinaryProtocolWriter*) const;
template uint32_t Empty::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const;
template uint32_t Empty::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const;
template void Empty::readNoXfer<>(apache::thrift::CompactProtocolReader*);
template uint32_t Empty::write<>(apache::thrift::CompactProtocolWriter*) const;
template uint32_t Empty::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const;
template uint32_t Empty::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const;


} // namespace apache::thrift::test

namespace apache::thrift::test { namespace {
[[maybe_unused]] FOLLY_ERASE void validateAdapters() {
}
}} // namespace apache::thrift::test
namespace apache::thrift::detail::annotation {
}
