From fc18efc259d115c70631cca08a347d28e3fd0c03 Mon Sep 17 00:00:00 2001 From: Bruno Dutra Date: Tue, 10 Feb 2015 20:59:54 -0200 Subject: [PATCH] Specializing insert_range for aux::map_tag Taking advantage of the fact that order of insertion doesn't really matter for associative sequences. Comparing to the default implementation, which at any rate does work for associative sequences, this specialization essencially avoids reinserting every element of Sequence into a new sequence, besides the fact no joint_view nor iterator_range needs to be instantiated. --- .../boost/mpl/map/aux_/insert_range_impl.hpp | 41 +++++++++++++++++++ include/boost/mpl/map/map0.hpp | 1 + 2 files changed, 42 insertions(+) create mode 100644 include/boost/mpl/map/aux_/insert_range_impl.hpp diff --git a/include/boost/mpl/map/aux_/insert_range_impl.hpp b/include/boost/mpl/map/aux_/insert_range_impl.hpp new file mode 100644 index 0000000..f1f0437 --- /dev/null +++ b/include/boost/mpl/map/aux_/insert_range_impl.hpp @@ -0,0 +1,41 @@ + +#ifndef BOOST_MPL_MAP_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED +#define BOOST_MPL_MAP_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED + +// Copyright Bruno Dutra 2015 +// +// 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/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include + +namespace boost { namespace mpl { + +template<> +struct insert_range_impl< aux::map_tag > +{ + template< + typename Sequence + , typename /*Pos*/ + , typename Range + > + struct apply + : fold > + { + }; +}; + +}} + +#endif // BOOST_MPL_MAP_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED diff --git a/include/boost/mpl/map/map0.hpp b/include/boost/mpl/map/map0.hpp index e1ea897..88ed4b7 100644 --- a/include/boost/mpl/map/map0.hpp +++ b/include/boost/mpl/map/map0.hpp @@ -19,6 +19,7 @@ #include //#include #include +#include #include #include #include