xtd 0.2.0
Loading...
Searching...
No Matches
array_static.h
Go to the documentation of this file.
1
4
5#if !defined(__XTD_ARRAY_INTERNAL__)
6#error "Do not include this file: Internal use only. Include <xtd/array> or <xtd/array.h> instead."
7#endif
8
10
12namespace xtd {
14 namespace collections::object_model {
15 template<typename type_t>
16 class read_only_collection;
17 }
19
48 template<>
49 class array_<> static_ {
50 public:
52
55
57
68 template<typename type_t, typename allocator_t>
70
89 //template<typename type_t, typename allocator_t>
90 //static int32 binary_search(const array_<type_t, 1, allocator_t>& array, int32 index, int32 length, const type_t& value) {return binary_search(array, index, length, value, xtd::collections::generic::comparer<type_t>::default_comparer);}
91
113 /*
114 template<typename type_t, typename allocator_t>
115 static xtd::size binary_search(const array_<type_t, 1, allocator_t>& array, xtd::size index, xtd::size count, const type_t& value, const xtd::collections::generic::icomparer<type_t>& comparer) {
116 if (index + count > array->Length) throw ArgumentException(caller_);
117
118 typename std::vector<type_t>::const_iterator first = array.array.begin();
119 typename std::vector<type_t>::const_iterator last = array.array.begin();
120 std::advance(first, index);
121 std::advance(last, index + count);
122 typename std::vector<type_t>::const_iterator position = std::lower_bound(first, last, value, array_<type_t>::Comparer(&comparer));
123
124 if (position != array.array.end() && !comparer->Compare(value, *position))
125 return (int32)std::distance(array.array.begin(), position);
126 return (int32)~std::distance(array.array.begin(), position);
127 }*/
128
144 //template<typename type_t, typename allocator_t>
145 //static xtd::size binary_search(const array_<type_t, 1, allocator_t>& array, const type_t& value) {return binary_search(array, 0, array.Length, value, xtd::collections::generic::comparer<type_t>::default_comparer.release());}
146
166 //template<typename type_t, typename allocator_t>
167 //static xtd::size binary_search(const array_<type_t, 1, allocator_t>& array, const type_t& value, const xtd::collections::generic::icomparer<type_t>& comparer) {return binary_search(array, 0, array.Length, value, comparer);}
169 };
170}
static xtd::collections::object_model::read_only_collection< type_t > as_read_only(const xtd::array_< type_t, 1, allocator_t > &array)
Returns a read-only wrapper for the specified array.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition __array_definition.h:49
Provides the base class for a generic read-only collection.
Definition read_only_collection.h:40
Contains xtd::collections::generic::comparer <type_t> interface.
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
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