CFx SDK Documentation  2022 SP0
OdMultimap.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 
26 
27 #ifndef OD_MULTIMAP_H
28 #define OD_MULTIMAP_H
29 
30 #define STL_USING_MAP
31 #include "OdaSTL.h"
32 
33 #include "OdPlatform.h"
34 
45 template<class Key,
46  class T,
47  class Pred = OD_TYPENAME std::less<Key>,
48  class A = OD_TYPENAME2 std::allocator<OD_TYPENAME2 std::pair<const Key, T> > >
49 class OdMultimap : public std::multimap<Key, T, Pred, A>
50 {
51 public:
52  typedef typename std::multimap<Key, T, Pred, A>::iterator iterator;
53  typedef typename std::multimap<Key, T, Pred, A>::const_iterator const_iterator;
54 
55  // 01.06.2002 G. Udov trying to eliminate using static variables
56 
57  OdMultimap(const Pred& comp = Pred(), const A& al = A())
58  : std::multimap<Key, T, Pred, A>(comp, al) {}
59 
60  OdMultimap(const typename std::multimap<Key, T, Pred, A>::value_type *first,
61  const typename std::multimap<Key, T, Pred, A>::value_type *last,
62  const Pred& comp = Pred(),
63  const A& al = A())
64  : std::multimap<Key, T, Pred, A>(first, last, comp, al) {}
65 
70  iterator find_ex(const Key& key)
71  {
72  iterator i = find (key),
73  iend = this->end();
74  while (i != iend && !this->key_comp() (key, i->first))
75  {
76  if (i->first == key)
77  return i;
78  ++i;
79  }
80  return iend;
81  }
82 
87  const_iterator find_ex(const Key& key) const
88  {
89  const_iterator i = find (key),
90  iend = this->end();
91  while (i != iend && !this->key_comp() (key, i->first))
92  {
93  if (i->first == key)
94  return i;
95  ++i;
96  }
97  return iend;
98  }
99 
104  iterator find_last(const Key& key)
105  {
106  iterator i = find (key), j,
107  iend = this->end();
108  while (i != iend && !this->key_comp() (key, i->first))
109  {
110  j = i;
111  ++i;
112  }
113  return j;
114  }
115 };
116 
117 
118 #endif // OD_MULTIMAP_H
119 
#define OD_TYPENAME2
Definition: OdPlatform.h:585
#define OD_TYPENAME
Definition: OdPlatform.h:581
OdMultimap(const typename std::multimap< Key, T, Pred, A >::value_type *first, const typename std::multimap< Key, T, Pred, A >::value_type *last, const Pred &comp=Pred(), const A &al=A())
Definition: OdMultimap.h:60
const_iterator find_ex(const Key &key) const
Definition: OdMultimap.h:87
iterator find_last(const Key &key)
Definition: OdMultimap.h:104
std::multimap< Key, T, Pred, A >::const_iterator const_iterator
Definition: OdMultimap.h:53
OdMultimap(const Pred &comp=Pred(), const A &al=A())
Definition: OdMultimap.h:57
std::multimap< Key, T, Pred, A >::iterator iterator
Definition: OdMultimap.h:52
iterator find_ex(const Key &key)
Definition: OdMultimap.h:70