From 7a8c8ffb4eabebb05feca1e9c1d04d77f6271a02 Mon Sep 17 00:00:00 2001 From: Bingyi Sun Date: Mon, 11 Sep 2023 17:55:23 +0800 Subject: [PATCH] Change cxx standard to 17 (#53) Signed-off-by: sunby --- cpp/CMakeLists.txt | 2 +- cpp/conanfile.py | 1 + cpp/include/milvus-storage/file/delete_fragment.h | 2 +- cpp/src/common/utils.cpp | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b5a7d668..a989b722 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -5,7 +5,7 @@ project(milvus-storage VERSION 0.1.0) option(WITH_UT "Build the testing tree." ON) option(WITH_ASAN "Build with address sanitizer." OFF) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(Boost REQUIRED) diff --git a/cpp/conanfile.py b/cpp/conanfile.py index 43c95238..2cbc3252 100644 --- a/cpp/conanfile.py +++ b/cpp/conanfile.py @@ -159,6 +159,7 @@ def package_info(self): self.cpp_info.components["libstorage"].requires = [ "boost::uuid", + "boost::algorithm", ] if self.options.with_ut: self.cpp_info.components["libstorage"].requires.append("gtest::gtest") diff --git a/cpp/include/milvus-storage/file/delete_fragment.h b/cpp/include/milvus-storage/file/delete_fragment.h index b396e567..745e98fd 100644 --- a/cpp/include/milvus-storage/file/delete_fragment.h +++ b/cpp/include/milvus-storage/file/delete_fragment.h @@ -65,7 +65,7 @@ class DeleteFragmentVisitor : public arrow::ArrayVisitor { delete_set_.emplace(value, std::vector()); continue; } - if (delete_set_.contains(value)) { + if (delete_set_.count(value) != 0) { auto v = version_col_->Value(i); delete_set_.at(value).push_back(version_col_->Value(i)); } else { diff --git a/cpp/src/common/utils.cpp b/cpp/src/common/utils.cpp index 6b511b99..0cbce872 100644 --- a/cpp/src/common/utils.cpp +++ b/cpp/src/common/utils.cpp @@ -10,6 +10,7 @@ #include "common/constants.h" #include "common/macro.h" #include "arrow/filesystem/path_util.h" +#include "boost/algorithm/string/predicate.hpp" #include namespace milvus_storage { @@ -265,7 +266,7 @@ std::string GetNewBlobFilePath(const std::string& path) { int64_t ParseVersionFromFileName(const std::string& path) { auto pos = path.find(kManifestFileSuffix); - if (pos == std::string::npos || !path.ends_with(kManifestFileSuffix)) { + if (pos == std::string::npos || !boost::algorithm::ends_with(path, kManifestFileSuffix)) { return -1; } auto version = path.substr(0, pos);