Fixed compilation on macos

This commit is contained in:
Bartek Kryza
2022-08-08 18:21:08 +02:00
parent e3434bfc59
commit b066348429
9 changed files with 37 additions and 27 deletions

View File

@@ -108,9 +108,9 @@ private:
namespace std {
template <>
struct hash<
std::reference_wrapper<const clanguml::class_diagram::model::class_>> {
std::reference_wrapper<clanguml::class_diagram::model::class_>> {
std::size_t operator()(const std::reference_wrapper<
const clanguml::class_diagram::model::class_> &key) const
clanguml::class_diagram::model::class_> &key) const
{
using clanguml::common::id_t;

View File

@@ -213,9 +213,9 @@ void diagram::get_parents(
bool found_new{false};
for (const auto &parent : parents) {
for (const auto &pp : parent.get().parents()) {
const auto p = get_class(pp.id());
auto p = get_class(pp.id());
if (p.has_value()) {
auto [it, found] = parents.emplace(p.value());
auto [it, found] = parents.emplace(std::ref(p.value()));
if (found)
found_new = true;
}

View File

@@ -219,7 +219,7 @@ private:
cd, element.get().path().to_string());
while (parent.has_value()) {
parents.emplace(std::ref(parent.value()));
parents.emplace(parent.value());
parent = detail::get<ElementT, DiagramT>(
cd, parent.value().path().to_string());
}

View File

@@ -57,9 +57,9 @@ private:
namespace std {
template <>
struct hash<std::reference_wrapper<const clanguml::common::model::package>> {
struct hash<std::reference_wrapper<clanguml::common::model::package>> {
std::size_t operator()(
const std::reference_wrapper<const clanguml::common::model::package>
const std::reference_wrapper<clanguml::common::model::package>
&key) const
{
using clanguml::common::id_t;

View File

@@ -144,9 +144,9 @@ template <> struct hash<clanguml::common::model::filesystem_path> {
namespace std {
template <>
struct hash<
std::reference_wrapper<const clanguml::common::model::source_file>> {
std::reference_wrapper<clanguml::common::model::source_file>> {
std::size_t operator()(
const std::reference_wrapper<const clanguml::common::model::source_file>
const std::reference_wrapper<clanguml::common::model::source_file>
&key) const
{
using clanguml::common::id_t;

View File

@@ -115,6 +115,6 @@ template <typename T>
using reference_vector = std::vector<std::reference_wrapper<T>>;
template <typename T>
using reference_set = std::unordered_set<std::reference_wrapper<const T>>;
using reference_set = std::unordered_set<std::reference_wrapper<T>>;
} // namespace clang::common

View File

@@ -103,7 +103,7 @@ void generator::generate(std::ostream &ostr) const
// Generate files and folders
util::for_each_if(
m_model, [this](const auto &f) { return true; },
m_model, [](const auto &f) { return true; },
[this, &ostr](const auto &f) {
generate(dynamic_cast<source_file &>(*f), ostr);
});

View File

@@ -253,9 +253,11 @@ bool starts_with(
normal_prefix /= element;
}
return std::search(normal_path.begin(), normal_path.end(),
normal_prefix.begin(),
normal_prefix.end()) == normal_path.begin();
auto normal_path_str = normal_path.string();
auto normal_prefix_str = normal_prefix.string();
return std::search(normal_path_str.begin(), normal_path_str.end(),
normal_prefix_str.begin(),
normal_prefix_str.end()) == normal_path_str.begin();
}
template <> bool starts_with(const std::string &s, const std::string &prefix)