source: NonGTP/Boost/boost/mpl/map/aux_/insert_impl.hpp @ 857

Revision 857, 1.8 KB checked in by igarcia, 18 years ago (diff)
Line 
1
2#ifndef BOOST_MPL_MAP_AUX_INSERT_IMPL_HPP_INCLUDED
3#define BOOST_MPL_MAP_AUX_INSERT_IMPL_HPP_INCLUDED
4
5// Copyright Aleksey Gurtovoy 2003-2004
6// Copyright David Abrahams 2003-2004
7//
8// Distributed under the Boost Software License, Version 1.0.
9// (See accompanying file LICENSE_1_0.txt or copy at
10// http://www.boost.org/LICENSE_1_0.txt)
11//
12// See http://www.boost.org/libs/mpl for documentation.
13
14// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/insert_impl.hpp,v $
15// $Date: 2004/12/14 14:05:31 $
16// $Revision: 1.4 $
17
18#include <boost/mpl/insert_fwd.hpp>
19#include <boost/mpl/next_prior.hpp>
20#include <boost/mpl/map/aux_/contains_impl.hpp>
21#include <boost/mpl/map/aux_/item.hpp>
22#include <boost/mpl/map/aux_/tag.hpp>
23#include <boost/mpl/aux_/na.hpp>
24#include <boost/mpl/aux_/config/typeof.hpp>
25
26namespace boost { namespace mpl {
27
28namespace aux {
29template< typename Map, typename Pair >
30struct map_insert_impl
31    : if_<
32          contains_impl<aux::map_tag>::apply<Map,Pair>
33        , Map
34#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
35        , m_item<
36              typename Pair::first
37            , typename Pair::second
38            , Map
39            >
40#else
41        , m_item<
42              next< typename Map::size >::type::value
43            , typename Pair::first
44            , typename Pair::second
45            , Map
46            >
47#endif
48        >
49{
50};
51}
52
53template<>
54struct insert_impl< aux::map_tag >
55{
56    template<
57          typename Map
58        , typename PosOrKey
59        , typename KeyOrNA
60        >
61    struct apply
62        : aux::map_insert_impl<
63              Map
64            , typename if_na<KeyOrNA,PosOrKey>::type
65            >
66    {
67    };
68};
69
70}}
71
72#endif // BOOST_MPL_MAP_AUX_INSERT_IMPL_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.