From f213f55f200236aa41c554fb33e3235172d5e2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 17 Sep 2014 21:49:47 +0200 Subject: [PATCH] Includes: Updated detail/xxx.hpp includes to core/xxx.hpp, added some missing move/traits.hpp and removed some unused ones. --- bench/bench_alloc_expand_bwd.cpp | 3 ++ bench/detail/varray.hpp | 54 +++++++------------ bench/detail/varray_util.hpp | 8 +-- bench/varray.hpp | 1 + include/boost/container/deque.hpp | 5 +- .../detail/adaptive_node_pool_impl.hpp | 2 +- .../container/detail/advanced_insert_int.hpp | 2 +- include/boost/container/detail/algorithms.hpp | 2 +- .../detail/allocator_version_traits.hpp | 2 +- .../container/detail/node_alloc_holder.hpp | 2 +- .../boost/container/detail/node_pool_impl.hpp | 2 +- include/boost/container/detail/pair.hpp | 30 +++++++++-- include/boost/container/detail/tree.hpp | 2 +- include/boost/container/detail/utilities.hpp | 6 +-- include/boost/container/flat_map.hpp | 3 +- include/boost/container/flat_set.hpp | 1 + include/boost/container/list.hpp | 2 +- include/boost/container/map.hpp | 3 +- include/boost/container/scoped_allocator.hpp | 2 +- include/boost/container/set.hpp | 1 + include/boost/container/slist.hpp | 4 +- include/boost/container/stable_vector.hpp | 2 +- include/boost/container/string.hpp | 7 ++- proj/vc7ide/alloc_lib.vcproj | 48 +++++++++++++++++ test/default_init_test.hpp | 2 +- test/deque_test.cpp | 2 +- test/insert_test.hpp | 2 +- test/insert_vs_emplace_test.cpp | 2 +- test/propagate_allocator_test.hpp | 2 +- test/static_vector_test.cpp | 4 +- test/throw_exception_test.cpp | 2 +- test/vector_test.hpp | 2 +- 32 files changed, 134 insertions(+), 78 deletions(-) diff --git a/bench/bench_alloc_expand_bwd.cpp b/bench/bench_alloc_expand_bwd.cpp index 3094968..b598ede 100644 --- a/bench/bench_alloc_expand_bwd.cpp +++ b/bench/bench_alloc_expand_bwd.cpp @@ -74,6 +74,9 @@ class MyInt }; namespace boost{ +template +struct has_trivial_destructor_after_move; + template<> struct has_trivial_destructor_after_move { diff --git a/bench/detail/varray.hpp b/bench/detail/varray.hpp index 30f791e..005251d 100644 --- a/bench/detail/varray.hpp +++ b/bench/detail/varray.hpp @@ -2,6 +2,7 @@ // // Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2011-2013 Andrew Hundt. +// Copyright (c) 2014-2014 Ion Gaztanaga // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -19,8 +20,6 @@ #include #include "varray_util.hpp" -//#include "varray_concept.hpp" -//#include #ifndef BOOST_NO_EXCEPTIONS #include @@ -37,10 +36,7 @@ #include #include -// TODO - use std::reverse_iterator and std::iterator_traits -// instead Boost.Iterator to remove dependency? -// or boost/detail/iterator.hpp ? -#include +#include /** * @defgroup varray_non_member varray non-member functions @@ -229,8 +225,6 @@ class varray (varray) ); - //BOOST_CONCEPT_ASSERT((concept::VArrayStrategy)); - typedef boost::aligned_storage< sizeof(Value[Capacity]), boost::alignment_of::value @@ -273,9 +267,9 @@ public: //! @brief The const iterator type. typedef const_pointer const_iterator; //! @brief The reverse iterator type. - typedef boost::reverse_iterator reverse_iterator; + typedef std::reverse_iterator reverse_iterator; //! @brief The const reverse iterator. - typedef boost::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; //! @brief The type of a strategy used by the varray. typedef Strategy strategy_type; @@ -334,7 +328,7 @@ public: //! @pre //! @li distance(first, last) <= capacity() - //! @li Iterator must meet the \c ForwardTraversalIterator concept. + //! @li Iterator must meet the \c ForwardIterator. //! //! @brief Constructs a varray containing copy of a range [first, last). //! @@ -353,8 +347,6 @@ public: varray(Iterator first, Iterator last) : m_size(0) { - //BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal)); // Make sure you passed a ForwardIterator - this->assign(first, last); // may throw } @@ -870,7 +862,7 @@ public: //! @pre //! @li \c position must be a valid iterator of \c *this in range [begin(), end()]. //! @li distance(first, last) <= capacity() - //! @li \c Iterator must meet the \c ForwardTraversalIterator concept. + //! @li \c Iterator must meet the \c ForwardIterator. //! //! @brief Inserts a copy of a range [first, last) at position. //! @@ -890,10 +882,8 @@ public: template iterator insert(iterator position, Iterator first, Iterator last) { - //BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal)); // Make sure you passed a ForwardIterator - - typedef typename boost::iterator_traversal::type traversal; - this->insert_dispatch(position, first, last, traversal()); + typedef typename std::iterator_traits::iterator_category category; + this->insert_dispatch(position, first, last, category()); return position; } @@ -975,10 +965,8 @@ public: template void assign(Iterator first, Iterator last) { - //BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal)); // Make sure you passed a ForwardIterator - - typedef typename boost::iterator_traversal::type traversal; - this->assign_dispatch(first, last, traversal()); // may throw + typedef typename std::iterator_traits::iterator_category category; + this->assign_dispatch(first, last, category()); // may throw } //! @pre count <= capacity() @@ -1726,10 +1714,8 @@ private: // @par Complexity // Linear O(N). template - void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&) + void insert_dispatch(iterator position, Iterator first, Iterator last, std::random_access_iterator_tag) { - //BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal)); // Make sure you passed a RandomAccessIterator - errh::check_iterator_end_eq(*this, position); typename boost::iterator_difference::type @@ -1755,8 +1741,8 @@ private: // or if Value's copy constructor or copy assignment throws. // @par Complexity // Linear O(N). - template - void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/) + template + void insert_dispatch(iterator position, Iterator first, Iterator last, Category const& /*not_random_access*/) { errh::check_iterator_end_eq(*this, position); @@ -1823,7 +1809,7 @@ private: // @par Complexity // Linear O(N). template - void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const& /*not_random_access*/) + void assign_dispatch(Iterator first, Iterator last, std::random_access_iterator_tag const& /*not_random_access*/) { namespace sv = varray_detail; @@ -1850,8 +1836,8 @@ private: // If Value's constructor or assignment taking dereferenced Iterator throws. // @par Complexity // Linear O(N). - template - void assign_dispatch(Iterator first, Iterator last, Traversal const& /*not_random_access*/) + template + void assign_dispatch(Iterator first, Iterator last, Category const& /*not_random_access*/) { namespace sv = varray_detail; @@ -1909,8 +1895,8 @@ public: typedef pointer iterator; typedef const_pointer const_iterator; - typedef boost::reverse_iterator reverse_iterator; - typedef boost::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; // nothrow varray() {} @@ -2014,8 +2000,6 @@ public: template void insert(iterator, Iterator first, Iterator last) { - // TODO - add MPL_ASSERT, check if Iterator is really an iterator - //typedef typename boost::iterator_traversal::type traversal; errh::check_capacity(*this, std::distance(first, last)); // may throw } @@ -2038,8 +2022,6 @@ public: template void assign(Iterator first, Iterator last) { - // TODO - add MPL_ASSERT, check if Iterator is really an iterator - //typedef typename boost::iterator_traversal::type traversal; errh::check_capacity(*this, std::distance(first, last)); // may throw } diff --git a/bench/detail/varray_util.hpp b/bench/detail/varray_util.hpp index 161e5ee..4f5540a 100644 --- a/bench/detail/varray_util.hpp +++ b/bench/detail/varray_util.hpp @@ -29,16 +29,12 @@ #include #include #include -//#include -//#include -//#include -//#include +#include -#include +#include #include #include #include -#include // TODO - move vectors iterators optimization to the other, optional file instead of checking defines? diff --git a/bench/varray.hpp b/bench/varray.hpp index c12b1a5..b1b916a 100644 --- a/bench/varray.hpp +++ b/bench/varray.hpp @@ -2,6 +2,7 @@ // // Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2011-2013 Andrew Hundt. +// Copyright (c) 2014-2014 Ion Gaztanaga // // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index eefbede..0ae3fb1 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,8 +39,9 @@ #include #include #include +#include #include -#include +#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include diff --git a/include/boost/container/detail/adaptive_node_pool_impl.hpp b/include/boost/container/detail/adaptive_node_pool_impl.hpp index b7261bf..dc1a7f1 100644 --- a/include/boost/container/detail/adaptive_node_pool_impl.hpp +++ b/include/boost/container/detail/adaptive_node_pool_impl.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include namespace boost { diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp index 45bc311..10438e1 100644 --- a/include/boost/container/detail/advanced_insert_int.hpp +++ b/include/boost/container/detail/advanced_insert_int.hpp @@ -26,7 +26,7 @@ #include #include //std::iterator_traits #include -#include +#include namespace boost { namespace container { namespace container_detail { diff --git a/include/boost/container/detail/algorithms.hpp b/include/boost/container/detail/algorithms.hpp index 9358995..6d8eab0 100644 --- a/include/boost/container/detail/algorithms.hpp +++ b/include/boost/container/detail/algorithms.hpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/include/boost/container/detail/allocator_version_traits.hpp b/include/boost/container/detail/allocator_version_traits.hpp index d4567da..18bb2ac 100644 --- a/include/boost/container/detail/allocator_version_traits.hpp +++ b/include/boost/container/detail/allocator_version_traits.hpp @@ -26,7 +26,7 @@ #include //integral_constant #include //pointer_traits #include //pair -#include //BOOST_TRY +#include //BOOST_TRY namespace boost { namespace container { diff --git a/include/boost/container/detail/node_alloc_holder.hpp b/include/boost/container/detail/node_alloc_holder.hpp index 6483e96..493a5c9 100644 --- a/include/boost/container/detail/node_alloc_holder.hpp +++ b/include/boost/container/detail/node_alloc_holder.hpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #ifndef BOOST_CONTAINER_PERFECT_FORWARDING #include diff --git a/include/boost/container/detail/node_pool_impl.hpp b/include/boost/container/detail/node_pool_impl.hpp index ce3eb5a..2450e51 100644 --- a/include/boost/container/detail/node_pool_impl.hpp +++ b/include/boost/container/detail/node_pool_impl.hpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/boost/container/detail/pair.hpp b/include/boost/container/detail/pair.hpp index 0d7e0a9..caad081 100644 --- a/include/boost/container/detail/pair.hpp +++ b/include/boost/container/detail/pair.hpp @@ -29,7 +29,7 @@ #include //std::swap #include -#include + #ifndef BOOST_CONTAINER_PERFECT_FORWARDING #include @@ -330,22 +330,42 @@ struct is_enum< ::boost::container::container_detail::pair > static const bool value = false; }; +template +struct is_class; + //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. template struct is_class< ::boost::container::container_detail::pair > - : public ::boost::true_type -{}; +{ + static const bool value = true; +}; #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template struct has_move_emulation_enabled< ::boost::container::container_detail::pair > - : ::boost::true_type -{}; +{ + static const bool value = true; +}; #endif +namespace move_detail{ + +template +struct is_class_or_union; + +template +struct is_class_or_union< ::boost::container::container_detail::pair > +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +{ + static const bool value = true; +}; + + +} //namespace move_detail{ } //namespace boost { diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp index 8ccf279..9e901a8 100644 --- a/include/boost/container/detail/tree.hpp +++ b/include/boost/container/detail/tree.hpp @@ -34,7 +34,7 @@ // #include #include -#include +#include // #ifndef BOOST_CONTAINER_PERFECT_FORWARDING #include diff --git a/include/boost/container/detail/utilities.hpp b/include/boost/container/detail/utilities.hpp index 4d604c5..31eba07 100644 --- a/include/boost/container/detail/utilities.hpp +++ b/include/boost/container/detail/utilities.hpp @@ -16,14 +16,12 @@ #include #include //for ::memmove / ::memcpy -#include #include #include -#include #include #include #include -#include +#include #include #include #include @@ -36,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index ca2181d..f76e207 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -29,7 +29,8 @@ #include #include #include -#include +#include +#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp index ef33f07..9779882 100644 --- a/include/boost/container/flat_set.hpp +++ b/include/boost/container/flat_set.hpp @@ -27,6 +27,7 @@ #include #include #include +#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index 0c96fd6..c93f300 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -24,10 +24,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index c5f24c8..c632fec 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -32,9 +32,10 @@ #include #include #include +#include #include #include -#include +#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include diff --git a/include/boost/container/scoped_allocator.hpp b/include/boost/container/scoped_allocator.hpp index e594c0a..a2ebe14 100644 --- a/include/boost/container/scoped_allocator.hpp +++ b/include/boost/container/scoped_allocator.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace boost { namespace container { diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp index 41230a3..dfb90ca 100644 --- a/include/boost/container/set.hpp +++ b/include/boost/container/set.hpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp index 6611b75..8aa1d76 100644 --- a/include/boost/container/slist.hpp +++ b/include/boost/container/slist.hpp @@ -22,13 +22,13 @@ #include #include #include +#include #include #include #include #include #include -#include -#include +#include #include #include diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index ef97482..6d723cc 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 2172e0e..dc909e2 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -45,9 +45,9 @@ #include #include #include -#include #include #include +#include namespace boost { namespace container { @@ -2895,6 +2895,9 @@ inline std::size_t hash_value(basic_string, Allocator> namespace boost { +template +struct has_trivial_destructor_after_move; + //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations template diff --git a/proj/vc7ide/alloc_lib.vcproj b/proj/vc7ide/alloc_lib.vcproj index 71615f0..497a4b8 100644 --- a/proj/vc7ide/alloc_lib.vcproj +++ b/proj/vc7ide/alloc_lib.vcproj @@ -182,9 +182,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #include -#include +#include #include #include "insert_test.hpp" diff --git a/test/deque_test.cpp b/test/deque_test.cpp index 029826a..7b1cdac 100644 --- a/test/deque_test.cpp +++ b/test/deque_test.cpp @@ -34,7 +34,7 @@ #include "propagate_allocator_test.hpp" #include "vector_test.hpp" #include "default_init_test.hpp" -#include +#include using namespace boost::container; diff --git a/test/insert_test.hpp b/test/insert_test.hpp index 1d589f1..fcd1428 100644 --- a/test/insert_test.hpp +++ b/test/insert_test.hpp @@ -7,7 +7,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include #include "check_equal_containers.hpp" namespace boost { diff --git a/test/insert_vs_emplace_test.cpp b/test/insert_vs_emplace_test.cpp index 4003a42..66d4c52 100644 --- a/test/insert_vs_emplace_test.cpp +++ b/test/insert_vs_emplace_test.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include class X { diff --git a/test/propagate_allocator_test.hpp b/test/propagate_allocator_test.hpp index 8901d77..6713889 100644 --- a/test/propagate_allocator_test.hpp +++ b/test/propagate_allocator_test.hpp @@ -11,7 +11,7 @@ #define BOOST_CONTAINER_PROPAGATE_ALLOCATOR_TEST_HPP #include -#include +#include #include "dummy_test_allocator.hpp" #include diff --git a/test/static_vector_test.cpp b/test/static_vector_test.cpp index 29788d2..69b5dd1 100644 --- a/test/static_vector_test.cpp +++ b/test/static_vector_test.cpp @@ -8,8 +8,8 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include -#include -#include +#include +#include #include #include diff --git a/test/throw_exception_test.cpp b/test/throw_exception_test.cpp index 2572dfe..2cbabef 100644 --- a/test/throw_exception_test.cpp +++ b/test/throw_exception_test.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include using namespace boost::container; diff --git a/test/vector_test.hpp b/test/vector_test.hpp index a8c4bf9..5a6a064 100644 --- a/test/vector_test.hpp +++ b/test/vector_test.hpp @@ -30,7 +30,7 @@ #include "input_from_forward_iterator.hpp" #include #include -#include +#include #include #include "insert_test.hpp"