7#include <xtd/argument_out_of_range_exception>
8#include <xtd/event_args>
9#include <xtd/event_handler>
12#include <xtd/size_object>
33 template<
typename type_t,
typename sorter_t = sorter_none>
43 template <
typename ...args_t>
44 value_type(args_t&& ...args) : type_t(args...) {}
46 if (value.owner) owner = value.owner;
47 if (owner !=
nullptr && !owner->inserting_ && !owner->erasing_) owner->
on_item_updated(pos,
static_cast<type_t&
>(
const_cast<value_type&
>(value)));
48 type_t::operator =(value);
52 if (value.owner) owner = value.owner;
53 if (owner !=
nullptr && !owner->inserting_ && !owner->erasing_) owner->
on_item_updated(pos,
static_cast<type_t&
>(value));
54 type_t::operator =(value);
57 operator type_t() {
return *
this;}
58 friend std::ostream& operator <<(std::ostream& os,
const value_type& value) {
return os << static_cast<const type_t&>(value);}
81 using pointer =
typename std::allocator_traits<allocator_type>::pointer;
83 using const_pointer =
typename std::allocator_traits<allocator_type>::const_pointer;
85 using iterator =
typename std::vector<value_type>::iterator;
118 for (
auto item : collection)
121 arranged_element_collection(
const arranged_element_collection& collection) {
push_back_range(collection);}
122 arranged_element_collection& operator =(
const arranged_element_collection& collection) {
127 arranged_element_collection(arranged_element_collection&&) =
default;
128 bool operator ==(
const arranged_element_collection& value)
const {
return collection_ == value.collection_;}
129 bool operator !=(
const arranged_element_collection& value)
const {
return !operator ==(value);}
143 collection_[pos].pos = pos;
144 collection_[pos].owner =
this;
145 return collection_.at(pos);
215 bool empty() const noexcept {
return collection_.empty();}
237 virtual bool sorted() const noexcept {
return sorted_;}
241 if (sorted_ != value) {
258 size_t index = pos -
begin();
260 iterator result = collection_.insert(pos, value);
262 (*this)[index].owner =
this;
263 (*this)[index].pos = index;
272 size_t index = pos -
begin();
274 iterator result = collection_.insert(pos, value);
276 (*this)[index].owner =
this;
277 (*this)[index].pos = index;
294 template<
typename ...args_t>
296 size_t index = pos -
begin();
298 iterator result = collection_.insert(pos, args...);
300 (*this)[index].owner =
this;
301 (*this)[index].pos = index;
309 template<
typename ...args_t>
311 collection_.push_back(args...);
312 size_t index = collection_.size() - 1;
313 (*this)[index].owner =
this;
314 (*this)[index].pos = index;
324 iterator result = collection_.erase(pos);
333 iterator result = collection_.erase(pos);
343 for (
iterator it = first; it <= last; ++it)
372 collection_.push_back(item);
373 size_t index = collection_.size() - 1;
374 (*this)[index].owner =
this;
375 (*this)[index].pos = index;
382 collection_.push_back(item);
383 size_t index = collection_.size() - 1;
384 (*this)[index].owner =
this;
385 (*this)[index].pos = index;
410 template<
typename collection_t>
412 for (
auto& item : collection)
417 template<
typename iterator_t>
419 for (
auto it =
begin; it !=
end; ++it)
432 std::vector<type_t>
array;
433 std::for_each(collection_.begin(), collection_.end(), [&](
auto item) {array.push_back(item);});
448 collection_[pos].pos = pos;
449 collection_[pos].owner =
this;
450 return collection_[pos];
455 collection_[pos].pos = pos;
457 return collection_[pos];
503 mutable std::vector<value_type, allocator_type> collection_;
504 bool inserting_ =
false;
505 bool erasing_ =
false;
506 bool sorted_ =
false;
The exception that is thrown when one of the arguments provided to a method is out of range.
Definition argument_out_of_range_exception.h:23
static constexpr type_t max_value
Represents the largest possible value of type_t. This field is constant.
Definition box_integer.h:67
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
size_t size
Represents a size of any object in bytes.
Definition size.h:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
std::vector< type_t > array
Definition __array_definition.h:18
Contains xtd::forms::layout::sorter_none class.