source: trunk/yat/utility/SegmentMap.h @ 2360

Last change on this file since 2360 was 2360, checked in by Peter, 12 years ago

refs #640. adding a functor in SegmentTree? to tranlate a value_type to key_type.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1#ifndef theplu_yat_utility_segment_map
2#define theplu_yat_utility_segment_map
3
4// $Id: SegmentMap.h 2360 2010-12-04 01:04:45Z peter $
5
6/*
7  Copyright (C) 2010 Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include "Segment.h"
26#include "SegmentTree.h"
27#include "stl_utility.h"
28
29#include <map>
30
31namespace theplu {
32namespace yat {
33namespace utility {
34
35  /**
36     \brief a map of Segments
37
38     A map with key Segment. The Segments cannot overlap.
39
40     \since new in yat 0.7
41   */
42  template<typename T, typename Tp, class Compare = std::less<T> >
43  class SegmentMap 
44    : public SegmentTree<std::map<Segment<T, Compare>, Tp, 
45                                  SegmentCompare<T, Compare> >,
46                   Compare,
47                   PairFirst<const std::pair<const Segment<T, Compare>, Tp> > >
48  {
49  public:
50    /// mapped type
51    typedef Tp mapped_type;
52   
53
54    /**
55       \brief creates a set with no segments
56     */
57    SegmentMap(void) {}
58
59  private:
60    // using compiler generated copying
61    //SegmentMap(const SegmentMap&);
62    //SegmentMap& operator=(const SegmentMap&);
63  };
64
65}}}
66#endif
Note: See TracBrowser for help on using the repository browser.