xtd 0.2.0
Loading...
Searching...
No Matches
collection_common.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "../../../self.hpp"
6
8namespace xtd {
10 namespace collections {
12 namespace generic {
14 namespace extensions {
31 template<class type_t, class collection_t>
32 class collection_common {
33 public:
35
39 virtual auto empty() const noexcept -> bool {return self().count() == 0;}
40
43 virtual auto size() const noexcept -> xtd::size {return self().count();}
45
47
52 virtual auto operator <<(const type_t& item) -> collection_t& {
53 self().add(item);
54 return self();
55 }
56
60 virtual auto operator <<(type_t&& item) -> collection_t& {
61 self().add(std::move(item));
62 return self();
63 }
64
70 virtual auto operator >>(const type_t& item) -> collection_t& {
71 self().remove(item);
72 return self();
73 }
74
75
76 private:
77 auto self() const noexcept -> const collection_t& {return static_cast<const collection_t&>(self_);}
78 auto self() noexcept -> collection_t& {return static_cast<collection_t&>(self_);}
79
80 friend collection_t;
81 collection_common() = default;
82 };
83 }
84 }
85 }
86}
virtual auto operator>>(const type_t &item) -> collection_t &
The shift right operator removes the first occurrence of a specific object from the xtd::collections:...
Definition collection_common.hpp:70
virtual auto empty() const noexcept -> bool
Checks whether the container is empty.
Definition collection_common.hpp:39
virtual auto size() const noexcept -> xtd::size
Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.
Definition collection_common.hpp:43
virtual auto operator<<(const type_t &item) -> collection_t &
The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>.
Definition collection_common.hpp:52
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
The xtd::extensions namespace contains interface extensions.
Definition collection_common.hpp:14
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains self_ keyword.