CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
hashset.h
1#pragma once
2
3#include "system/collections/iequality_comparer.h"
4#include "system/collections/base_set.h"
5
6#include <unordered_set>
7
8namespace System {
9namespace Collections {
10namespace Generic {
11
13template<typename T> class HashSet;
14
19template<typename T>
20class ASPOSECPP_SHARED_CLASS HashSetPtr : public SharedPtr<HashSet<T> >
21{
22public:
27 HashSetPtr(const SharedPtr<HashSet<T> >& obj) : SharedPtr<HashSet<T> >(obj) { }
28};
29
80template<typename T>
81class ASPOSECPP_SHARED_CLASS HashSet : public BaseSet<T, std::unordered_set<T, EqualityComparerHashAdapter<T>, EqualityComparerAdapter<T>, typename System::Details::CollectionHelpers::ContainerPointerMode<T>::allocator_type>>
82{
83public:
87 using BaseType = BaseSet<T, std::unordered_set<T, EqualityComparerHashAdapter<T>, EqualityComparerAdapter<T>, typename System::Details::CollectionHelpers::ContainerPointerMode<T>::allocator_type>>;
90
91private:
93 RTTI_INFO_TEMPLATE_CLASS(ThisType, System::BaseTypesInfo<System::Object>)
94
95public:
98
100 HashSet(int capacity) : BaseType(capacity) {}
101
106 {
107 }
108
110 HashSet(const SharedPtr<IEnumerable<T>>& items) : BaseType(items) {}
111
112#ifdef __DBG_FOR_EACH_MEMBER
113public:
116 void DBG_for_each_member(DBG::for_each_member_visitor &visitor) const override
117 {
118 BaseType::DBG_for_each_member(visitor);
119 visitor.add_self(this);
120 }
123 const char* DBG_class_name() const override { return "HashSet<T>"; }
124#endif
125
126protected:
128 ~HashSet() override {}
129#ifdef ASPOSE_GET_SHARED_MEMBERS
131 DEFINE_GET_SHARED_MEMBERS(BaseType::m_data);
132#endif
133};
134
135} // namespace Generic
136} // namespace Collections
137} // namespace System
Definition: base_set.h:19
Forward declaration of HashSet class.
Definition: hashset.h:82
HashSet(const SharedPtr< IEnumerable< T > > &items)
Creates hashset based on enumerable values.
Definition: hashset.h:110
HashSet(int capacity)
Creates empty set with specified capacity.
Definition: hashset.h:100
HashSet()
RTTI information.
Definition: hashset.h:97
~HashSet() override
Destructor.
Definition: hashset.h:128
HashSet(const SharedPtr< IEqualityComparer< T > > &comparer)
Creates empty set that uses the specified equality comparer.
Definition: hashset.h:104
Pointer to keep HashSet references. This type is a pointer to manage other object's deletion....
Definition: hashset.h:21
HashSetPtr()
Null pointer constructor.
Definition: hashset.h:24
HashSetPtr(const SharedPtr< HashSet< T > > &obj)
Copy constructor.
Definition: hashset.h:27
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
Interface providing means to compare two objects for equality. Objects of this class should only be a...
Definition: iequality_comparer.h:17
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 making it possible using IEqualityComparer with STL-styled collections and algorithms....
Definition: iequality_comparer.h:38
Adapter to use IEqualityComparer for hashing. Uses comparator object, if set; otherwise,...
Definition: iequality_comparer.h:159