From c123accab156bd3e884e319447cec0693733f11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Mon, 28 Aug 2017 10:45:29 +0200 Subject: [PATCH] Complete support for user-provided containers to flat_[multi]map/set containers, and instantiate them with several container types. --- .../detail/container_or_allocator_rebind.hpp | 49 ++++ .../container/detail/container_rebind.hpp | 258 ++++++++++++++++++ include/boost/container/detail/flat_tree.hpp | 208 +++++++++----- include/boost/container/flat_map.hpp | 21 +- include/boost/container/flat_set.hpp | 5 +- test/flat_map_test.cpp | 77 +++--- test/flat_set_test.cpp | 66 +++-- test/flat_tree_test.cpp | 2 +- 8 files changed, 555 insertions(+), 131 deletions(-) create mode 100644 include/boost/container/detail/container_or_allocator_rebind.hpp create mode 100644 include/boost/container/detail/container_rebind.hpp diff --git a/include/boost/container/detail/container_or_allocator_rebind.hpp b/include/boost/container/detail/container_or_allocator_rebind.hpp new file mode 100644 index 0000000..c60d1c0 --- /dev/null +++ b/include/boost/container/detail/container_or_allocator_rebind.hpp @@ -0,0 +1,49 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2017-2017. 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/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP +#define BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace container { +namespace container_detail { + +template::value> +struct container_or_allocator_rebind_impl + : container_rebind +{}; + +template +struct container_or_allocator_rebind_impl + : allocator_traits::template portable_rebind_alloc + +{}; + +template +struct container_or_allocator_rebind + : container_or_allocator_rebind_impl +{}; + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP diff --git a/include/boost/container/detail/container_rebind.hpp b/include/boost/container/detail/container_rebind.hpp new file mode 100644 index 0000000..79ad9d7 --- /dev/null +++ b/include/boost/container/detail/container_rebind.hpp @@ -0,0 +1,258 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2017-2017. 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/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP +#define BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include + + +namespace boost { +namespace container { +namespace container_detail { + + template + struct container_rebind; + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template