Skip to content

Commit 23b78f2

Browse files
committed
chore: add compatibility with c++ 20
1 parent 00a5f1b commit 23b78f2

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

.github/workflows/ci-pr-validation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
sudo apt-get install -y libcurl4-openssl-dev libssl-dev \
168168
protobuf-compiler libprotobuf-dev libboost-dev \
169169
libboost-dev libboost-program-options-dev \
170-
libzstd-dev libsnappy-dev libgmock-dev libgtest-dev
170+
libzstd-dev libsnappy-dev libgmock-dev libgtest-dev libroaring-dev
171171
- name: CMake
172172
run: cmake -B build -DBUILD_PERF_TOOLS=ON -DCMAKE_CXX_STANDARD=20
173173
- name: Build

LegacyFindPackages.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ endif ()
9393
message("Protobuf_INCLUDE_DIRS: " ${Protobuf_INCLUDE_DIRS})
9494
message("Protobuf_LIBRARIES: " ${Protobuf_LIBRARIES})
9595

96+
find_package(roaring REQUIRED)
97+
9698
# NOTE: CMake might not find curl and zlib on some platforms like Ubuntu, in this case, find them manually
9799
set(CURL_NO_CURL_CMAKE ON)
98100
find_package(curl QUIET)
@@ -129,6 +131,7 @@ if (LINK_STATIC AND NOT VCPKG_TRIPLET)
129131
elseif (LINK_STATIC AND VCPKG_TRIPLET)
130132
find_package(Protobuf REQUIRED)
131133
message(STATUS "Found protobuf static library: " ${Protobuf_LIBRARIES})
134+
find_package(roaring REQUIRED)
132135
if (MSVC AND (${CMAKE_BUILD_TYPE} STREQUAL Debug))
133136
find_library(ZLIB_LIBRARIES NAMES zlibd)
134137
else ()

lib/NegativeAcksTracker.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ using ClientImplPtr = std::shared_ptr<ClientImpl>;
4242
class ExecutorService;
4343
using ExecutorServicePtr = std::shared_ptr<ExecutorService>;
4444
using LedgerId = int64_t;
45+
#if __cplusplus >= 202002L
46+
using ConditionalRoaringMap = Roaring64Map;
47+
#else
48+
using ConditionalRoaringMap = roaring::Roaring64Map;
49+
#endif
4550

4651
class NegativeAcksTracker : public std::enable_shared_from_this<NegativeAcksTracker> {
4752
public:
@@ -68,7 +73,7 @@ class NegativeAcksTracker : public std::enable_shared_from_this<NegativeAcksTrac
6873
std::chrono::milliseconds nackDelay_;
6974
std::chrono::milliseconds timerInterval_;
7075
typedef typename std::chrono::steady_clock Clock;
71-
std::map<Clock::time_point, std::unordered_map<LedgerId, roaring::Roaring64Map>> nackedMessages_;
76+
std::map<Clock::time_point, std::unordered_map<LedgerId, ConditionalRoaringMap>> nackedMessages_;
7277

7378
const DeadlineTimerPtr timer_;
7479
std::atomic_bool closed_{false};

vcpkg.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
"name": "protobuf",
4444
"version>=": "3.21.12"
4545
},
46+
{
47+
"name": "roaring",
48+
"version>=": "2.0.4"
49+
},
4650
{
4751
"name": "snappy",
4852
"version>=": "1.1.10"
@@ -54,9 +58,6 @@
5458
{
5559
"name": "zstd",
5660
"version>=": "1.5.5"
57-
},
58-
{
59-
"name": "roaring"
6061
}
6162
],
6263
"features": {

0 commit comments

Comments
 (0)