diff --git a/CMakeLists.txt b/CMakeLists.txt index 63971d0..c09be61 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5) project(BLT VERSION 0.8.1) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) diff --git a/src/blt/parse/argparse.cpp b/src/blt/parse/argparse.cpp index 54d6275..6cbb4c2 100755 --- a/src/blt/parse/argparse.cpp +++ b/src/blt/parse/argparse.cpp @@ -47,7 +47,7 @@ namespace blt void arg_vector_t::validateFlags() { for (const auto& flag : flags) - if (!flag.starts_with('-')) + if (!blt::string::starts_with(flag, '-')) throw invalid_argument_exception("Flag '" + flag + "' must start with - or --"); } @@ -74,7 +74,7 @@ namespace blt std::string flag = flags[0]; // search for first '--' flag for (const auto& f : flags) - if (f.starts_with("--")) + if (blt::string::starts_with(f, "--")) { flag = f; break; @@ -91,7 +91,7 @@ namespace blt std::string to_string(const arg_data_t& v) { - if (holds_alternative(v)) + if (std::holds_alternative(v)) return to_string(std::get(v)); else if (std::holds_alternative(v)) { @@ -145,9 +145,9 @@ namespace blt properties->a_dest = properties->a_flags.name; } - if (properties->a_dest.starts_with("--")) + if (blt::string::starts_with(properties->a_dest, "--")) properties->a_dest = properties->a_dest.substr(2); - else if (properties->a_dest.starts_with('-')) + else if (blt::string::starts_with(properties->a_dest, '-')) properties->a_dest = properties->a_dest.substr(1); // associate flags with their properties @@ -266,12 +266,12 @@ namespace blt tokenizer.advance(); // token is a flag, figure out how to handle it - if (flag.starts_with("--")) + if (blt::string::starts_with(flag, "--")) processFlag(tokenizer, flag); else { // handle special args like -vvv - if (!flag.starts_with('-')) + if (!blt::string::starts_with(flag, '-')) std::cerr << "Flag processed but does not start with '-' (this is a serious error!)\n"; // make sure the flag only contains the same character auto type = flag[1]; diff --git a/src/blt/profiling/profiler_v2.cpp b/src/blt/profiling/profiler_v2.cpp index 45f7449..8f754e5 100644 --- a/src/blt/profiling/profiler_v2.cpp +++ b/src/blt/profiling/profiler_v2.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace blt { @@ -215,7 +216,7 @@ namespace blt void _internal::startInterval(const std::string& profile_name, const std::string& interval_name) { auto& profile = profiles[profile_name]; - if (!profile.contains(interval_name)) + if (profile.find(interval_name) == profile.end()) { auto interval = new interval_t(); interval->interval_name = interval_name; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8175123..659a8b2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,9 +5,7 @@ option(ENABLE_ADDRSAN "Enable the address sanitizer" ON) option(ENABLE_UBSAN "Enable the ub sanitizer" ON) option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF) -set(CMAKE_CXX_STANDARD 20) - -add_subdirectory(../) +set(CMAKE_CXX_STANDARD 17) include_directories(include/) file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")