This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 5c018448d3 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
5c018448d3 is described below

commit 5c018448d3f64a02b0d6fb3cef7a4e11556b53d1
Author: chaokunyang <[email protected]>
AuthorDate: Tue Mar 24 04:37:54 2026 +0000

    🔄 synced local 'docs/guide/' with remote 'docs/guide/'
---
 docs/guide/cpp/field-configuration.md | 19 +++++++++----------
 docs/guide/cpp/index.md               | 11 ++++-------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/docs/guide/cpp/field-configuration.md 
b/docs/guide/cpp/field-configuration.md
index 899a52f6f8..94f5170dd5 100644
--- a/docs/guide/cpp/field-configuration.md
+++ b/docs/guide/cpp/field-configuration.md
@@ -225,7 +225,7 @@ int main() {
   doc.description = "A sample document";
   doc.metadata = nullptr;  // Allowed because nullable
   doc.parent = std::make_shared<Document>();
-  doc.parent->title = "Parent Doc";
+  doc.parent.get()->title = "Parent Doc";
   doc.related = nullptr;  // Allowed because nullable
 
   auto bytes = fory.serialize(doc).value();
@@ -429,15 +429,14 @@ int main() {
   auto fory = Fory::builder().xlang(true).build();
   fory.register_struct<MetricsData>(100);
 
-  MetricsData data{
-      .request_count = 42,
-      .bytes_sent = 1024,
-      .user_id = 12345678,
-      .session_id = 9876543210,
-      .created_at = 1704067200000000000ULL, // 2024-01-01 in nanoseconds
-      .error_count = 3,
-      .last_access_time = std::nullopt
-  };
+  MetricsData data;
+  data.request_count = 42;
+  data.bytes_sent = 1024;
+  data.user_id = 12345678;
+  data.session_id = 9876543210;
+  data.created_at = 1704067200000000000ULL; // 2024-01-01 in nanoseconds
+  data.error_count = 3;
+  data.last_access_time = std::nullopt;
 
   auto bytes = fory.serialize(data).value();
   auto decoded = fory.deserialize<MetricsData>(bytes).value();
diff --git a/docs/guide/cpp/index.md b/docs/guide/cpp/index.md
index 6348faf419..344820bb0f 100644
--- a/docs/guide/cpp/index.md
+++ b/docs/guide/cpp/index.md
@@ -137,11 +137,13 @@ See the 
[examples/cpp](https://github.com/apache/fory/tree/main/examples/cpp) di
 
 ```cpp
 #include "fory/serialization/fory.h"
+#include <string>
+#include <vector>
 
 using namespace fory::serialization;
 
 // Define a struct
-class Person {
+struct Person {
   std::string name;
   int32_t age;
   std::vector<std::string> hobbies;
@@ -149,13 +151,8 @@ class Person {
   bool operator==(const Person &other) const {
     return name == other.name && age == other.age && hobbies == other.hobbies;
   }
-
-public:
-  // Register the struct with Fory (FORY_STRUCT must be in public scope).
-  FORY_STRUCT(Person, name, age, hobbies);
 };
-
-
+FORY_STRUCT(Person, name, age, hobbies);
 
 int main() {
   // Create a Fory instance


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to