summaryrefslogtreecommitdiff
path: root/boost/container/list.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:21:30 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:21:30 +0900
commitd6a306e745acfee00e81ccaf3324a2a03516db41 (patch)
tree145a26368608982f40ebb0f4836185c44abb9ae4 /boost/container/list.hpp
parent5ce2ccf2f23c6d3de4c79f216f57ca6f2a18ed16 (diff)
downloadboost-d6a306e745acfee00e81ccaf3324a2a03516db41.tar.gz
boost-d6a306e745acfee00e81ccaf3324a2a03516db41.tar.bz2
boost-d6a306e745acfee00e81ccaf3324a2a03516db41.zip
Imported Upstream version 1.69.0upstream/1.69.0
Diffstat (limited to 'boost/container/list.hpp')
-rw-r--r--boost/container/list.hpp52
1 files changed, 43 insertions, 9 deletions
diff --git a/boost/container/list.hpp b/boost/container/list.hpp
index 68892bc2bb..4be33fc111 100644
--- a/boost/container/list.hpp
+++ b/boost/container/list.hpp
@@ -71,20 +71,54 @@ template <class T, class VoidPointer>
struct list_node
: public list_hook<VoidPointer>::type
{
- private:
- list_node();
-
public:
typedef T value_type;
+ typedef T internal_type;
typedef typename list_hook<VoidPointer>::type hook_type;
- T m_data;
+ typedef typename aligned_storage<sizeof(T), alignment_of<T>::value>::type storage_t;
+ storage_t m_storage;
+
+ #if defined(BOOST_GCC) && (BOOST_GCC >= 40600) && (BOOST_GCC < 80000)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+ #define BOOST_CONTAINER_DISABLE_ALIASING_WARNING
+ # endif
+
+ BOOST_CONTAINER_FORCEINLINE T &get_data()
+ { return *reinterpret_cast<T*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE const T &get_data() const
+ { return *reinterpret_cast<const T*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE T *get_data_ptr()
+ { return reinterpret_cast<T*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE const T *get_data_ptr() const
+ { return reinterpret_cast<T*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE internal_type &get_real_data()
+ { return *reinterpret_cast<internal_type*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE const internal_type &get_real_data() const
+ { return *reinterpret_cast<const internal_type*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE internal_type *get_real_data_ptr()
+ { return reinterpret_cast<internal_type*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE const internal_type *get_real_data_ptr() const
+ { return reinterpret_cast<internal_type*>(this->m_storage.data); }
+
+ BOOST_CONTAINER_FORCEINLINE ~list_node()
+ { reinterpret_cast<T*>(this->m_storage.data)->~T(); }
- T &get_data()
- { return this->m_data; }
+ #if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING)
+ #pragma GCC diagnostic pop
+ #undef BOOST_CONTAINER_DISABLE_ALIASING_WARNING
+ # endif
- const T &get_data() const
- { return this->m_data; }
+ BOOST_CONTAINER_FORCEINLINE void destroy_header()
+ { static_cast<hook_type*>(this)->~hook_type(); }
};
template <class T, class VoidPointer>
@@ -1464,7 +1498,7 @@ class list
};
-#if __cplusplus >= 201703L
+#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
template <typename InputIterator>
list(InputIterator, InputIterator) ->
list<typename iterator_traits<InputIterator>::value_type>;