xtd 1.0.0
Loading...
Searching...
No Matches
list_common.hpp
Go to the documentation of this file.
1
4#pragma once
5#define __XTD_CORE_INTERNAL__
7#undef __XTD_CORE_INTERNAL__
8#include "../../../self.hpp"
9
11namespace xtd {
13 struct index;
14 class range;
16
18 namespace collections {
20 namespace generic {
22 namespace extensions {
39 template<typename type_t, typename list_t>
40 class list_common {
41 public:
43
48 [[nodiscard]] virtual auto operator ()(xtd::usize index) const -> const type_t& {
49 return self().operator [](index);
50 }
51
54 [[nodiscard]] virtual auto operator ()(xtd::usize index) -> type_t& {
55 return self().operator [](index);
56 }
57
61 [[nodiscard]] auto operator [](const xtd::index& index) const -> const type_t&;
65 [[nodiscard]] auto operator [](const xtd::index& index) -> type_t&;
66
70 [[nodiscard]] auto operator ()(const xtd::index& index) const -> const type_t&;
74 [[nodiscard]] auto operator ()(const xtd::index& index) -> type_t&;
75
79 [[nodiscard]] auto operator [](const xtd::range& range) const -> xtd::read_only_span<type_t>;
83 [[nodiscard]] auto operator [](const xtd::range& range) -> xtd::span<type_t>;
84
88 [[nodiscard]] auto operator ()(const xtd::range& range) const -> xtd::read_only_span<type_t>;
92 [[nodiscard]] auto operator ()(const xtd::range& range) -> xtd::span<type_t>;
94
95 private:
96 auto self() const noexcept -> const list_t& {return static_cast<const list_t&>(self_);}
97 auto self() noexcept -> list_t& {return static_cast<list_t&>(self_);}
98
99 friend list_t;
100 list_common() = default;
101 };
102 }
103 }
104 }
105}
virtual auto operator()(xtd::usize index) const -> const type_t &
Gets the element at the specified index.
Definition list_common.hpp:48
auto operator[](const xtd::index &index) const -> const type_t &
Gets the element at the specified index.
Represents a range that has start and end indexes.
Definition range.hpp:28
Represents a non-owning view over a contiguous sequence of objects.
Definition span.hpp:58
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
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
constexpr read_only_span()
Creates an empty xtd::read_only_span whose xtd::read_only_span::data is null and xtd::read_only_span:...
Definition read_only_span.hpp:88
Contains self_ keyword.