Skip to content

Commit

Permalink
IIDM v1.6.0: fix compilation on CentOS 7
Browse files Browse the repository at this point in the history
Signed-off-by: Frédéric Vallée <[email protected]>
  • Loading branch information
Frédéric Vallée authored and gautierbureau committed Nov 15, 2023
1 parent 85245e4 commit d5f27be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions extensions/iidm/src/BranchObservability.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,35 @@ const std::string& BranchObservability::getName() const {
}

stdcxx::CReference<ObservabilityQuality> BranchObservability::getQualityP1() const {
return stdcxx::cref(m_qualityP1);
return stdcxx::cref<ObservabilityQuality>(m_qualityP1);
}

stdcxx::Reference<ObservabilityQuality> BranchObservability::getQualityP1() {
return stdcxx::ref(m_qualityP1);
return stdcxx::ref<ObservabilityQuality>(m_qualityP1);
}

stdcxx::CReference<ObservabilityQuality> BranchObservability::getQualityP2() const {
return stdcxx::cref(m_qualityP2);
return stdcxx::cref<ObservabilityQuality>(m_qualityP2);
}

stdcxx::Reference<ObservabilityQuality> BranchObservability::getQualityP2() {
return stdcxx::ref(m_qualityP2);
return stdcxx::ref<ObservabilityQuality>(m_qualityP2);
}

stdcxx::CReference<ObservabilityQuality> BranchObservability::getQualityQ1() const {
return stdcxx::cref(m_qualityQ1);
return stdcxx::cref<ObservabilityQuality>(m_qualityQ1);
}

stdcxx::Reference<ObservabilityQuality> BranchObservability::getQualityQ1() {
return stdcxx::ref(m_qualityQ1);
return stdcxx::ref<ObservabilityQuality>(m_qualityQ1);
}

stdcxx::CReference<ObservabilityQuality> BranchObservability::getQualityQ2() const {
return stdcxx::cref(m_qualityQ2);
return stdcxx::cref<ObservabilityQuality>(m_qualityQ2);
}

stdcxx::Reference<ObservabilityQuality> BranchObservability::getQualityQ2() {
return stdcxx::ref(m_qualityQ2);
return stdcxx::ref<ObservabilityQuality>(m_qualityQ2);
}

const std::type_index& BranchObservability::getType() const {
Expand Down
8 changes: 4 additions & 4 deletions include/powsybl/stdcxx/reference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ CReference<T> cref(const std::unique_ptr<T>& pointer) {
return static_cast<bool>(pointer) ? CReference<T>(*pointer) : CReference<T>();
}

template <typename T, typename = typename std::enable_if<!std::is_abstract<T>::value>::type>
CReference<T> cref(const stdcxx::optional<T>& optional) {
template <typename T, typename U, typename = typename std::enable_if<!std::is_abstract<U>::value && std::is_same<T, U>::value>::type>
CReference<T> cref(const stdcxx::optional<U>& optional) {
return static_cast<bool>(optional) ? CReference<T>(*optional) : CReference<T>();
}

Expand Down Expand Up @@ -138,8 +138,8 @@ Reference<T> ref(const std::unique_ptr<T>& pointer) {
return static_cast<bool>(pointer) ? Reference<T>(*pointer) : Reference<T>();
}

template <typename T, typename = typename std::enable_if<!std::is_abstract<T>::value>::type>
Reference<T> ref(stdcxx::optional<T>& optional) {
template <typename T, typename U, typename = typename std::enable_if<!std::is_abstract<U>::value && std::is_same<T, U>::value>::type>
Reference<T> ref(stdcxx::optional<U>& optional) {
return static_cast<bool>(optional) ? Reference<T>(*optional) : Reference<T>();
}

Expand Down

0 comments on commit d5f27be

Please sign in to comment.