xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
xtd.core
include
xtd
collections
generic
extensions
collection_common.hpp
Go to the documentation of this file.
1
4
#pragma once
5
#include "
../../../self.hpp
"
6
8
namespace
xtd
{
10
namespace
collections
{
12
namespace
generic
{
14
namespace
extensions
{
31
template
<
typename
type_t,
typename
collection_t>
32
class
collection_common {
33
public
:
35
39
[[nodiscard]]
virtual
auto
empty
() const noexcept ->
bool
{
return
self().count() == 0;}
40
43
[[nodiscard]]
virtual
auto
size
() const noexcept ->
xtd
::
usize
{
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
}
xtd::collections::generic::extensions::collection_common::operator>>
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
xtd::collections::generic::extensions::collection_common::size
virtual auto size() const noexcept -> xtd::usize
Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>.
Definition
collection_common.hpp:43
xtd::collections::generic::extensions::collection_common::empty
virtual auto empty() const noexcept -> bool
Checks whether the container is empty.
Definition
collection_common.hpp:39
xtd::collections::generic::extensions::collection_common::operator<<
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
self_
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition
self.hpp:20
xtd::usize
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition
usize.hpp:22
xtd::collections::generic::extensions
The xtd::extensions namespace contains interface extensions.
Definition
collection_common.hpp:14
xtd::collections::generic
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition
comparer.hpp:16
xtd::collections
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition
any_pair.hpp:10
xtd
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition
abstract_object.hpp:8
self.hpp
Contains self_ keyword.
Generated on
for xtd by
Gammasoft
. All rights reserved.