diff options
Diffstat (limited to 'boost/multi_index/detail')
-rw-r--r-- | boost/multi_index/detail/archive_constructed.hpp | 6 | ||||
-rw-r--r-- | boost/multi_index/detail/ignore_wstrict_aliasing.hpp | 18 | ||||
-rw-r--r-- | boost/multi_index/detail/index_node_base.hpp | 6 | ||||
-rw-r--r-- | boost/multi_index/detail/promotes_arg.hpp | 10 | ||||
-rw-r--r-- | boost/multi_index/detail/restore_wstrict_aliasing.hpp | 11 | ||||
-rw-r--r-- | boost/multi_index/detail/rnk_index_ops.hpp | 12 | ||||
-rw-r--r-- | boost/multi_index/detail/seq_index_ops.hpp | 6 |
7 files changed, 55 insertions, 14 deletions
diff --git a/boost/multi_index/detail/archive_constructed.hpp b/boost/multi_index/detail/archive_constructed.hpp index c3891bb32a..0a7a26e0d4 100644 --- a/boost/multi_index/detail/archive_constructed.hpp +++ b/boost/multi_index/detail/archive_constructed.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2015 Joaquin M Lopez Munoz. +/* Copyright 2003-2016 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -64,8 +64,12 @@ struct archive_constructed:private noncopyable (&get())->~T(); } +#include <boost/multi_index/detail/ignore_wstrict_aliasing.hpp> + T& get(){return *reinterpret_cast<T*>(&space);} +#include <boost/multi_index/detail/restore_wstrict_aliasing.hpp> + private: typename aligned_storage<sizeof(T),alignment_of<T>::value>::type space; }; diff --git a/boost/multi_index/detail/ignore_wstrict_aliasing.hpp b/boost/multi_index/detail/ignore_wstrict_aliasing.hpp new file mode 100644 index 0000000000..ae398456d1 --- /dev/null +++ b/boost/multi_index/detail/ignore_wstrict_aliasing.hpp @@ -0,0 +1,18 @@ +/* Copyright 2003-2016 Joaquin M Lopez Munoz. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * See http://www.boost.org/libs/multi_index for library home page. + */ + +#include <boost/config.hpp> + +#if defined(BOOST_GCC)&&(BOOST_GCC>=4*10000+6*100) +#if !defined(BOOST_MULTI_INDEX_DETAIL_RESTORE_WSTRICT_ALIASING) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#else +#pragma GCC diagnostic pop +#endif +#endif diff --git a/boost/multi_index/detail/index_node_base.hpp b/boost/multi_index/detail/index_node_base.hpp index e6fabe62bb..1a1f0cae4b 100644 --- a/boost/multi_index/detail/index_node_base.hpp +++ b/boost/multi_index/detail/index_node_base.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2015 Joaquin M Lopez Munoz. +/* Copyright 2003-2016 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -49,6 +49,8 @@ struct index_node_base:private pod_value_holder<Value> typedef Value value_type; typedef Allocator allocator_type; +#include <boost/multi_index/detail/ignore_wstrict_aliasing.hpp> + value_type& value() { return *reinterpret_cast<value_type*>(&this->space); @@ -59,6 +61,8 @@ struct index_node_base:private pod_value_holder<Value> return *reinterpret_cast<const value_type*>(&this->space); } +#include <boost/multi_index/detail/restore_wstrict_aliasing.hpp> + static index_node_base* from_value(const value_type* p) { return static_cast<index_node_base *>( diff --git a/boost/multi_index/detail/promotes_arg.hpp b/boost/multi_index/detail/promotes_arg.hpp index 75cf4368cf..7a11b6e9fb 100644 --- a/boost/multi_index/detail/promotes_arg.hpp +++ b/boost/multi_index/detail/promotes_arg.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2014 Joaquin M Lopez Munoz. +/* Copyright 2003-2017 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -14,15 +14,14 @@ #endif #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ -#include <boost/mpl/bool.hpp> -#include <boost/type_traits/intrinsics.hpp> +#include <boost/detail/workaround.hpp> /* Metafunctions to check if f(arg1,arg2) promotes either arg1 to the type of * arg2 or viceversa. By default, (i.e. if it cannot be determined), no * promotion is assumed. */ -#if !defined(BOOST_IS_CONVERTIBLE) +#if BOOST_WORKAROUND(BOOST_MSVC,<1400) namespace boost{ @@ -45,6 +44,7 @@ struct promotes_2nd_arg:mpl::false_{}; #else #include <boost/mpl/and.hpp> +#include <boost/mpl/bool.hpp> #include <boost/mpl/not.hpp> #include <boost/multi_index/detail/is_transparent.hpp> #include <boost/type_traits/is_convertible.hpp> @@ -79,5 +79,5 @@ struct promotes_2nd_arg: } /* namespace boost */ -#endif /* defined(BOOST_IS_CONVERTIBLE) */ +#endif #endif diff --git a/boost/multi_index/detail/restore_wstrict_aliasing.hpp b/boost/multi_index/detail/restore_wstrict_aliasing.hpp new file mode 100644 index 0000000000..ee2c799d5a --- /dev/null +++ b/boost/multi_index/detail/restore_wstrict_aliasing.hpp @@ -0,0 +1,11 @@ +/* Copyright 2003-2016 Joaquin M Lopez Munoz. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * See http://www.boost.org/libs/multi_index for library home page. + */ + +#define BOOST_MULTI_INDEX_DETAIL_RESTORE_WSTRICT_ALIASING +#include <boost/multi_index/detail/ignore_wstrict_aliasing.hpp> +#undef BOOST_MULTI_INDEX_DETAIL_RESTORE_WSTRICT_ALIASING diff --git a/boost/multi_index/detail/rnk_index_ops.hpp b/boost/multi_index/detail/rnk_index_ops.hpp index 275642236b..fb233cf497 100644 --- a/boost/multi_index/detail/rnk_index_ops.hpp +++ b/boost/multi_index/detail/rnk_index_ops.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2015 Joaquin M Lopez Munoz. +/* Copyright 2003-2017 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -109,7 +109,7 @@ inline std::size_t ranked_index_find_rank( { if(!top)return 0; - std::size_t s=top->size, + std::size_t s=top->impl()->size, s0=s; Node* y0=y; @@ -162,7 +162,7 @@ inline std::size_t ranked_index_lower_bound_rank( { if(!top)return 0; - std::size_t s=top->size; + std::size_t s=top->impl()->size; do{ if(!comp(key(top->value()),x)){ @@ -213,7 +213,7 @@ inline std::size_t ranked_index_upper_bound_rank( { if(!top)return 0; - std::size_t s=top->size; + std::size_t s=top->impl()->size; do{ if(comp(x,key(top->value()))){ @@ -266,7 +266,7 @@ inline std::pair<std::size_t,std::size_t> ranked_index_equal_range_rank( { if(!top)return std::pair<std::size_t,std::size_t>(0,0); - std::size_t s=top->size; + std::size_t s=top->impl()->size; do{ if(comp(key(top->value()),x)){ @@ -279,7 +279,7 @@ inline std::pair<std::size_t,std::size_t> ranked_index_equal_range_rank( } else{ return std::pair<std::size_t,std::size_t>( - s-top->size+ + s-top->impl()->size+ ranked_index_lower_bound_rank( Node::from_impl(top->left()),top,key,x,comp,mpl::false_()), s-ranked_node_size(top->right())+ diff --git a/boost/multi_index/detail/seq_index_ops.hpp b/boost/multi_index/detail/seq_index_ops.hpp index a3c2bc1f04..142bdd9dd9 100644 --- a/boost/multi_index/detail/seq_index_ops.hpp +++ b/boost/multi_index/detail/seq_index_ops.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2015 Joaquin M Lopez Munoz. +/* Copyright 2003-2016 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -110,6 +110,8 @@ BOOST_STATIC_CONSTANT( sequenced_index_sort_max_fill= (std::size_t)std::numeric_limits<std::size_t>::digits+1); +#include <boost/multi_index/detail/ignore_wstrict_aliasing.hpp> + template<typename Node,typename Compare> void sequenced_index_sort(Node* header,Compare comp) { @@ -190,6 +192,8 @@ void sequenced_index_sort(Node* header,Compare comp) BOOST_CATCH_END } +#include <boost/multi_index/detail/restore_wstrict_aliasing.hpp> + } /* namespace multi_index::detail */ } /* namespace multi_index */ |