CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
sorted_set.h
1#pragma once
2
3#include "system/collections/base_set.h"
4
5#include <set>
6
7namespace System {
8namespace Collections {
9namespace Generic {
10
12template<typename T> class SortedSet;
13
18template<typename T>
19class ASPOSECPP_SHARED_CLASS SortedSetPtr : public SharedPtr<SortedSet<T>>
20{
21public:
27};
28
34template<typename T>
35class ASPOSECPP_SHARED_CLASS SortedSet : public BaseSet<T, std::set<T, ComparerAdapter<T>, typename System::Details::CollectionHelpers::ContainerPointerMode<T>::allocator_type>>
36{
37public:
41 using BaseType = BaseSet<T, std::set<T, ComparerAdapter<T>, typename System::Details::CollectionHelpers::ContainerPointerMode<T>::allocator_type>>;
44
45private:
47 RTTI_INFO_TEMPLATE_CLASS(ThisType, System::BaseTypesInfo<System::Object>);
48
49public:
52
54 SortedSet(int capacity) : BaseType(capacity) {}
55
59 : BaseType(ComparerAdapter<T>(comparer))
60 {
61 }
62
64 SortedSet(const SharedPtr<IEnumerable<T>>& items) : BaseType(items) {}
65
68 T get_Max() const
69 {
70 if (BaseType::m_data.empty())
71 throw ArgumentOutOfRangeException(u"SortedSet is empty");
72 return *BaseType::m_data.rbegin();
73 }
74
75#ifdef __DBG_FOR_EACH_MEMBER
76public:
79 void DBG_for_each_member(DBG::for_each_member_visitor &visitor) const override
80 {
81 BaseType::DBG_for_each_member(visitor);
82 visitor.add_self(this);
83 }
86 const char* DBG_class_name() const override { return "SortedSet<T>"; }
87#endif
88
89protected:
91 ~SortedSet() override {}
92#ifdef ASPOSE_GET_SHARED_MEMBERS
94 DEFINE_GET_SHARED_MEMBERS(BaseType::m_data);
95#endif
96};
97
98} // namespace Generic
99} // namespace Collections
100} // namespace System
Definition: base_set.h:19
Interface of collection of elements. Objects of this class should only be allocated using System::Mak...
Definition: icollection.h:20
Interface that compares two objects in greater-equal-less sense. Objects of this class should only be...
Definition: icomparer.h:20
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
Forward declaration of SortedSet class.
Definition: sorted_set.h:36
SortedSet()
Creates empty set.
Definition: sorted_set.h:51
T get_Max() const
Gets the maximum value in the SortedSet.
Definition: sorted_set.h:68
SortedSet(const SharedPtr< IComparer< T > > &comparer)
Creates empty set that uses the specified equality comparer.
Definition: sorted_set.h:58
SortedSet(const SharedPtr< IEnumerable< T > > &items)
Creates SortedSet based on enumerable values.
Definition: sorted_set.h:64
~SortedSet() override
Destructor.
Definition: sorted_set.h:91
SortedSet(int capacity)
Creates empty set with specified capacity.
Definition: sorted_set.h:54
Pointer to keep SortedSet references. This type is a pointer to manage other object's deletion....
Definition: sorted_set.h:20
SortedSetPtr(const SharedPtr< SortedSet< T > > &obj)
Copy constructor.
Definition: sorted_set.h:26
SortedSetPtr()
Null pointer constructor.
Definition: sorted_set.h:23
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Definition: db_command.h:9
Adapter to use IComparer within STL environment. Uses IComparer if set; otherwise,...
Definition: icomparer.h:44