mirror of
https://github.com/boostorg/graph.git
synced 2026-01-31 08:12:14 +00:00
Fix compilation with gcc 4.4 in C++11 mode
Add constructor and assignment operator implementations for gcc 4.4 since it does not support defaulted move constructors and assignment. The operators are also used for gcc 4.5 for good measure (I cannot test it but gcc 4.6 does not need this workaround). Also the workaround is used for MSVC as well. The previous MSVC branch was incorrect since it did not invoke base class constructors and assignment.
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_GRAPH_MOVE_IF_POSSIBLE(x) (x)
|
||||
#else
|
||||
#include <utility>
|
||||
#define BOOST_GRAPH_MOVE_IF_POSSIBLE(x) (std::move((x)))
|
||||
#endif
|
||||
|
||||
@@ -295,11 +296,23 @@ namespace boost {
|
||||
inline stored_edge_property(Vertex target,
|
||||
const Property& p = Property())
|
||||
: stored_edge<Vertex>(target), m_property(new Property(p)) { }
|
||||
#if defined(BOOST_MSVC)
|
||||
inline stored_edge_property(self&& x) {std::swap(m_property, x.m_property);};
|
||||
inline stored_edge_property(self const& x) {std::swap(m_property, const_cast<self&>(x).m_property);};
|
||||
inline self& operator=(self&& x) { std::swap(m_property, x.m_property); return *this;};
|
||||
inline self& operator=(self& x) { std::swap(m_property, x.m_property); return *this;};
|
||||
#if defined(BOOST_MSVC) || (defined(BOOST_GCC) && (BOOST_GCC / 100) < 406)
|
||||
stored_edge_property(self&& x) : Base(static_cast< Base const& >(x)) {
|
||||
m_property.swap(x.m_property);
|
||||
}
|
||||
stored_edge_property(self const& x) : Base(static_cast< Base const& >(x)) {
|
||||
m_property.swap(const_cast<self&>(x).m_property);
|
||||
}
|
||||
self& operator=(self&& x) {
|
||||
Base::operator=(static_cast< Base const& >(x));
|
||||
m_property = std::move(x.m_property);
|
||||
return *this;
|
||||
}
|
||||
self& operator=(self& x) {
|
||||
Base::operator=(static_cast< Base const& >(x));
|
||||
m_property = std::move(x.m_property);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
stored_edge_property(self&& x) = default;
|
||||
self& operator=(self&& x) = default;
|
||||
|
||||
Reference in New Issue
Block a user