8#include <xtd/argument_out_of_range_exception>
9#include <xtd/event_args>
10#include <xtd/event_handler>
13#include <xtd/size_object>
34 template<
class type_t,
class sorter_t = sorter_none>
44 template<
class ...args_t>
45 value_type(args_t&& ...args) : type_t(args...) {}
47 if (value.owner) owner = value.owner;
48 if (owner !=
nullptr && !owner->inserting_ && !owner->erasing_) owner->
on_item_updated(pos,
static_cast<type_t&
>(
const_cast<value_type&
>(value)));
49 type_t::operator =(value);
53 if (value.owner) owner = value.owner;
54 if (owner !=
nullptr && !owner->inserting_ && !owner->erasing_) owner->
on_item_updated(pos,
static_cast<type_t&
>(value));
55 type_t::operator =(value);
58 operator type_t() {
return *
this;}
59 friend std::ostream& operator <<(std::ostream& os,
const value_type& value) {
return os << static_cast<const type_t&>(value);}
82 using pointer =
typename std::allocator_traits<allocator_type>::pointer;
84 using const_pointer =
typename std::allocator_traits<allocator_type>::const_pointer;
86 using iterator =
typename std::vector<value_type>::iterator;
119 for (
auto item : collection)
122 arranged_element_collection(
const arranged_element_collection& collection) {
push_back_range(collection);}
123 arranged_element_collection& operator =(
const arranged_element_collection& collection) {
128 arranged_element_collection(arranged_element_collection&&) =
default;
129 bool operator ==(
const arranged_element_collection& value)
const {
return collection_ == value.collection_;}
130 bool operator !=(
const arranged_element_collection& value)
const {
return !operator ==(value);}
144 collection_[pos].pos = pos;
145 collection_[pos].owner =
this;
146 return collection_.at(pos);
216 bool empty() const noexcept {
return collection_.empty();}
238 virtual bool sorted() const noexcept {
return sorted_;}
242 if (sorted_ != value) {
259 size_t index = pos -
begin();
261 iterator result = collection_.insert(pos, value);
263 (*this)[index].owner =
this;
264 (*this)[index].pos = index;
273 size_t index = pos -
begin();
275 iterator result = collection_.insert(pos, value);
277 (*this)[index].owner =
this;
278 (*this)[index].pos = index;
295 template<
class ...args_t>
297 size_t index = pos -
begin();
299 iterator result = collection_.insert(pos, args...);
301 (*this)[index].owner =
this;
302 (*this)[index].pos = index;
310 template<
class ...args_t>
312 collection_.push_back(args...);
313 size_t index = collection_.size() - 1;
314 (*this)[index].owner =
this;
315 (*this)[index].pos = index;
325 iterator result = collection_.erase(pos);
334 iterator result = collection_.erase(pos);
344 for (
iterator it = first; it <= last; ++it)
373 collection_.push_back(item);
374 size_t index = collection_.size() - 1;
375 (*this)[index].owner =
this;
376 (*this)[index].pos = index;
383 collection_.push_back(item);
384 size_t index = collection_.size() - 1;
385 (*this)[index].owner =
this;
386 (*this)[index].pos = index;
411 template<
class collection_t>
413 for (
auto& item : collection)
418 template<
class iterator_t>
420 for (
auto it =
begin; it !=
end; ++it)
447 collection_[pos].pos = pos;
448 collection_[pos].owner =
this;
449 return collection_[pos];
454 collection_[pos].pos = pos;
456 return collection_[pos];
502 mutable std::vector<value_type, allocator_type> collection_;
503 bool inserting_ =
false;
504 bool erasing_ =
false;
505 bool sorted_ =
false;
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:59
static constexpr type_t max_value
Represents the largest possible value of type_t. This field is constant.
Definition box_integer.hpp:67
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
Throws an exption with specified exception case.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
@ argument_out_of_range
The argument is out of range.
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::forms::layout::sorter_none class.