Change std::same_as to std::is_same_v to maintain C++17 compatibility (Fixes #188)

This commit is contained in:
Bartek Kryza
2023-10-12 11:13:00 +02:00
parent 13a1012e96
commit 8865a42ff0

View File

@@ -263,12 +263,12 @@ template <typename T>
void save_diagram(const std::filesystem::path &path, const T &diagram) void save_diagram(const std::filesystem::path &path, const T &diagram)
{ {
static_assert( static_assert(
std::same_as<T, std::string> || std::same_as<T, nlohmann::json>); std::is_same_v<T, std::string> || std::is_same_v<T, nlohmann::json>);
std::filesystem::create_directories(path.parent_path()); std::filesystem::create_directories(path.parent_path());
std::ofstream ofs; std::ofstream ofs;
ofs.open(path, std::ofstream::out | std::ofstream::trunc); ofs.open(path, std::ofstream::out | std::ofstream::trunc);
if constexpr (std::same_as<T, nlohmann::json>) { if constexpr (std::is_same_v<T, nlohmann::json>) {
ofs << std::setw(2) << diagram; ofs << std::setw(2) << diagram;
} }
else { else {