20 #ifndef OPM_IORDER_SET_HPP 21 #define OPM_IORDER_SET_HPP 28 #include <unordered_set> 55 : index_ {
data.begin(),
data.end() }
58 if (this->data_.size() != this->index_.size()) {
59 throw std::invalid_argument {
60 "Initial sequence has duplicate elements" 68 return this->index_.size();
74 return this->
size() == 0;
84 return this->index_.find(
value) != this->index_.end();
99 const auto& stat = this->index_.insert(
value);
102 this->data_.push_back(
value);
122 this->index_.erase(
value);
124 const auto data_iter = std::ranges::find(this->data_,
value);
125 this->data_.erase(data_iter);
131 auto begin()
const {
return this->data_.begin(); }
134 auto end()
const {
return this->data_.end(); }
146 return this->data_.at(i);
150 const std::vector<T>&
data()
const 163 return (this->index_ ==
data.index_)
164 && (this->data_ ==
data.data_);
172 template <
class Serializer>
175 serializer(this->index_);
176 serializer(this->data_);
181 std::unordered_set<T> index_{};
184 std::vector<T> data_{};
189 #endif // OPM_IORDER_SET_HPP std::size_t erase(const T &value)
Remove element from collection.
Definition: IOrderSet.hpp:116
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: IOrderSet.hpp:173
const T & operator[](const std::size_t i) const
Access element by index in ordered collection view.
Definition: IOrderSet.hpp:144
auto empty() const
Whether or not this collection is empty.
Definition: IOrderSet.hpp:72
auto begin() const
Iterator to first element in ordered collection view.
Definition: IOrderSet.hpp:131
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
IOrderSet(const std::vector< T > &data)
Constructor.
Definition: IOrderSet.hpp:54
auto size() const
Number of elements in collection.
Definition: IOrderSet.hpp:66
const std::vector< T > & data() const
Ordered collection view.
Definition: IOrderSet.hpp:150
Set of elements which preserves order of element insertion.
Definition: IOrderSet.hpp:40
bool operator==(const IOrderSet< T > &data) const
Equality predicate.
Definition: IOrderSet.hpp:161
auto contains(const T &value) const
Whether or not a particular element exists in the collection.
Definition: IOrderSet.hpp:82
auto end() const
End of ordered collection view.
Definition: IOrderSet.hpp:134
bool insert(const T &value)
Insert element into collection.
Definition: IOrderSet.hpp:97
IOrderSet()=default
Default constructor.
Class for (de-)serializing.
Definition: Serializer.hpp:94