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

thiru pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/main by this push:
     new dd01f9786 AVRO-4106: [C++] Remove boost::random (#3283)
dd01f9786 is described below

commit dd01f97869e374d6427bec999afa089f760791ab
Author: Gang Wu <[email protected]>
AuthorDate: Tue Jan 7 12:21:46 2025 +0800

    AVRO-4106: [C++] Remove boost::random (#3283)
---
 lang/c++/impl/DataFile.cc         | 4 ++--
 lang/c++/impl/avrogencpp.cc       | 7 +++----
 lang/c++/include/avro/Specific.hh | 2 --
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/lang/c++/impl/DataFile.cc b/lang/c++/impl/DataFile.cc
index c22f05853..63ea7df20 100644
--- a/lang/c++/impl/DataFile.cc
+++ b/lang/c++/impl/DataFile.cc
@@ -20,13 +20,13 @@
 #include "Compiler.hh"
 #include "Exception.hh"
 
+#include <random>
 #include <sstream>
 
 #include <boost/crc.hpp> // for boost::crc_32_type
 #include <boost/iostreams/device/file.hpp>
 #include <boost/iostreams/filter/gzip.hpp>
 #include <boost/iostreams/filter/zlib.hpp>
-#include <boost/random/mersenne_twister.hpp>
 
 #ifdef SNAPPY_CODEC_AVAILABLE
 #include <snappy.h>
@@ -236,7 +236,7 @@ void DataFileWriterBase::flush() {
 }
 
 DataFileSync DataFileWriterBase::makeSync() {
-    boost::mt19937 random(static_cast<uint32_t>(time(nullptr)));
+    std::mt19937 random(static_cast<uint32_t>(time(nullptr)));
     DataFileSync sync;
     std::generate(sync.begin(), sync.end(), random);
     return sync;
diff --git a/lang/c++/impl/avrogencpp.cc b/lang/c++/impl/avrogencpp.cc
index 323aa5168..d39764122 100644
--- a/lang/c++/impl/avrogencpp.cc
+++ b/lang/c++/impl/avrogencpp.cc
@@ -24,14 +24,13 @@
 #include <iostream>
 #include <map>
 #include <optional>
+#include <random>
 #include <set>
+#include <utility>
 
 #include <boost/algorithm/string.hpp>
 #include <boost/program_options.hpp>
 
-#include <boost/random/mersenne_twister.hpp>
-#include <utility>
-
 #include "Compiler.hh"
 #include "NodeImpl.hh"
 #include "ValidSchema.hh"
@@ -89,7 +88,7 @@ class CodeGen {
     const std::string includePrefix_;
     const bool noUnion_;
     const std::string guardString_;
-    boost::mt19937 random_;
+    std::mt19937 random_;
 
     vector<PendingSetterGetter> pendingGettersAndSetters;
     vector<PendingConstructor> pendingConstructors;
diff --git a/lang/c++/include/avro/Specific.hh 
b/lang/c++/include/avro/Specific.hh
index 1c4b183b5..fc28b3f5e 100644
--- a/lang/c++/include/avro/Specific.hh
+++ b/lang/c++/include/avro/Specific.hh
@@ -25,8 +25,6 @@
 #include <string>
 #include <vector>
 
-#include "boost/blank.hpp"
-
 #include "AvroTraits.hh"
 #include "Config.hh"
 #include "Decoder.hh"

Reply via email to