CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
OdMultiset.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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_MULTISET_H
28#define OD_MULTISET_H
29
30#define STL_USING_SET
31#include "OdaSTL.h"
32
33#include "OdPlatform.h"
34
45template<class Key,
46 class Pred = OD_TYPENAME std::less<Key>,
47 class A = OD_TYPENAME2 std::allocator<Key> >
48class OdMultiset : public std::multiset<Key, Pred, A>
49{
50public:
51 typedef typename std::multiset<Key, Pred, A>::iterator iterator;
52 typedef typename std::multiset<Key, Pred, A>::const_iterator const_iterator;
53
54 // 01.06.2002 G. Udov trying to eliminate using static variables
55
56 OdMultiset(const Pred& comp = Pred(), const A& al = A())
57 : std::multiset<Key, Pred, A>(comp, al) {}
58
59 OdMultiset(const typename std::multiset<Key, Pred, A>::value_type *first,
60 const typename std::multiset<Key, Pred, A>::value_type *last,
61 const Pred& comp = Pred(),
62 const A& al = A())
63 : std::multiset<Key, Pred, A>(first, last, comp, al) {}
64
69 iterator find_ex(const Key& key)
70 {
71 iterator i = std::multiset<Key, Pred, A>::find (key),
72 iend = this->end();
73 while (i != iend && !this->key_comp() (key, *i))
74 {
75 if (*i == key)
76 return i;
77 ++i;
78 }
79 return iend;
80 }
81
82 // This method and the previous one do the same. But the former is used for constant objects.
90 const_iterator find_ex(const Key& key) const
91 {
92 const_iterator i = this->find (key), // FELIX_CHANGE this-> added
93 iend = this->end();
94 while (i != iend && !this->key_comp() (key, *i))
95 {
96 if (*i == key)
97 return i;
98 ++i;
99 }
100 return iend;
101 }
102
107 iterator find_last(const Key& key)
108 {
109 iterator i = find (key), j,
110 iend = this->end();
111 while (i != iend && !this->key_comp() (key, *i))
112 {
113 j = i;
114 ++i;
115 }
116 return j;
117 }
118};
119
120#endif // OD_MULTISET_H
#define OD_TYPENAME2
Definition: OdPlatform.h:635
#define OD_TYPENAME
Definition: OdPlatform.h:631
std::multiset< Key, Pred, A >::iterator iterator
Definition: OdMultiset.h:51
const_iterator find_ex(const Key &key) const
Definition: OdMultiset.h:90
OdMultiset(const typename std::multiset< Key, Pred, A >::value_type *first, const typename std::multiset< Key, Pred, A >::value_type *last, const Pred &comp=Pred(), const A &al=A())
Definition: OdMultiset.h:59
std::multiset< Key, Pred, A >::const_iterator const_iterator
Definition: OdMultiset.h:52
iterator find_ex(const Key &key)
Definition: OdMultiset.h:69
iterator find_last(const Key &key)
Definition: OdMultiset.h:107
OdMultiset(const Pred &comp=Pred(), const A &al=A())
Definition: OdMultiset.h:56