Manages a compact array of bit values, which are represented as booleans, where true indicates that the bit is on (1) and false indicates the bit is off (0).
Public Aliases | |
| using | value_type |
| Represents the list value type. | |
| using | base_type |
| Represents the list base type. | |
| using | size_type |
| Represents the list size type (usually xtd::usize). | |
| using | difference_type |
| Represents the list difference type (usually xtd::ptrdiff). | |
| using | reference |
| Represents the reference of list value type. | |
| using | const_reference |
| Represents the const reference of list value type. | |
| using | pointer |
| Represents the pointer of list value type. | |
| using | const_pointer |
| Represents the const pointer of list value type. | |
Public Constructors | |
| bit_array (xtd::usize length) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that can hold the specified number of bit values, which are initially set to false. | |
| bit_array (xtd::usize length, bool defaultValue) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that can hold the specified number of bit values, which are initially set to the specified value. | |
| bit_array (std::initializer_list< bool > il) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified initializer list of booleans. | |
| bit_array (const xtd::array< bool > &values) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified array of booleans. | |
| bit_array (const xtd::array< xtd::byte > &values) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified array of bytes. | |
| bit_array (const xtd::array< int32 > &values) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified array of 32-bit integers. | |
| template<xtd::usize length> | |
| bit_array (const std::bitset< length > &bit_set) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified bitset. | |
| bit_array (const std::vector< bool > &booleans) noexcept | |
| Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified std::vector<bool>. | |
Public Properties | |
| template<xtd::usize length> | |
| auto | bits () const noexcept -> std::bitset< length > |
| Returns a std::bitset object containing the Booleans contained in the current xtd::collections::bit_array. | |
| auto | bits () const noexcept -> std::vector< bool > |
| Returns a std::vector<bool> object containing the Booleans contained in the current xtd::collections::bit_array. | |
| auto | count () const noexcept -> xtd::usize override |
| Gets the number of elements contained in the xtd::collections::bit_array. | |
| auto | length () const noexcept -> xtd::usize |
| Gets the number of elements contained in the xtd::collections::bit_array. | |
| auto | length (xtd::usize value) -> void |
| Sets the number of elements contained in the xtd::collections::bit_array. | |
Public Methods | |
| auto | and_ (const bit_array &value) -> const bit_array & |
| Performs the bitwise AND operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| xtd::uptr< xtd::object > | clone () const override |
| Creates a new object that is a copy of the current instance. | |
| auto | copy_to (xtd::array< bool > &array, xtd::usize index) const -> void override |
| Copies the elements of the xtd::collections::bit_array to an xtd::array, starting at a particular xtd::array index. | |
| auto | equals (const bit_array &value) const noexcept -> bool override |
| Determines whether this instance of xtd::collections::bit_array and a specified object, which must also be a xtd::collections::bit_array object, have the same value. | |
| auto | equals (const object &obj) const noexcept -> bool override |
| Determines whether this instance of xtd::collections::bit_array and a specified object, which must also be a xtd::collections::bit_array object, have the same value. | |
| auto | get (xtd::usize index) const -> bool |
| Gets the value of the bit at a specific position in the xtd::collections::bit_array. | |
| auto | get (xtd::usize index) -> bool & |
| Gets the value of the bit at a specific position in the xtd::collections::bit_array. | |
| xtd::collections::generic::enumerator< bool > | get_enumerator () const override |
| Returns an enumerator that iterates through a collection. | |
| auto | has_all_set () const noexcept -> bool |
| Determines whether all bits in the xtd::collections::bit_array are set to true. | |
| auto | has_any_set () const noexcept -> bool |
| Determines whether any bit in the xtd::collections::bit_array is set to true. | |
| auto | left_shift (xtd::usize count) noexcept -> bit_array & |
| Shifts all the bit values of the current xtd::collections::bit_array to the left on count bits. | |
| auto | not_ () -> const bit_array & |
| Inverts all the bit values in the current xtd::collections::bit_array, so that elements set to true are changed to false, and elements set to false are changed to true. | |
| auto | or_ (const bit_array &value) -> const bit_array & |
| Performs the bitwise OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| auto | right_shift (xtd::usize count) noexcept -> bit_array & |
| Shifts all the bit values of the current xtd::collections::bit_array to the right on count bits. | |
| auto | set (xtd::usize index, bool value) -> void |
| Sets the value of the bit at a specific position in the xtd::collections::bit_array. | |
| auto | set_all (bool value) -> void |
| Sets all bits in the xtd::collections::bit_array to the specified value. | |
| auto | to_string () const noexcept -> xtd::string override |
| Returns a xtd::string that represents the current object. | |
| auto | xor_ (const bit_array &value) -> const bit_array & |
| Performs the bitwise exclusive OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
Public Operators | |
| auto | operator[] (xtd::usize index) const -> const bool & |
| Gets the element at the specified index. | |
| auto | operator[] (xtd::usize index) -> bool & |
| Gets or Sets the element at the specified index. | |
| auto | operator& (const bit_array &value) const -> bit_array |
| Performs the bitwise AND operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| auto | operator&= (const bit_array &value) -> bit_array & |
| Performs the bitwise AND operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| auto | operator| (const bit_array &value) const -> bit_array |
| Performs the bitwise OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| auto | operator|= (const bit_array &value) -> bit_array & |
| Performs the bitwise OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| auto | operator^ (const bit_array &value) const -> bit_array |
| Performs the bitwise exclusive OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| auto | operator^= (const bit_array &value) -> bit_array & |
| Performs the bitwise exclusive OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array. | |
| auto | operator~ () const -> bit_array |
| Inverts all the bit values in the current xtd::collections::bit_array, so that elements set to true are changed to false, and elements set to false are changed to true. | |
| auto | operator>> (xtd::usize count) const noexcept -> bit_array |
| The right shift operator shifts all the bit values of the current xtd::collections::bit_array to the right on count bits. | |
| auto | operator>>= (xtd::usize count) noexcept -> bit_array & |
| The right shift operator shifts all the bit values of the current xtd::collections::bit_array to the right on count bits. | |
| auto | operator<< (xtd::usize count) const noexcept -> bit_array |
| The left shift operator shifts all the bit values of the current xtd::collections::bit_array to the left on count bits. | |
| auto | operator<<= (xtd::usize count) noexcept -> bit_array & |
| The left shift operator shifts all the bit values of the current xtd::collections::bit_array to the left on count bits. | |
Additional Inherited Members | |
| using | value_type |
| Represents the xtd::collections::generic::icollection value type. | |
| using | value_type |
| Represents the xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of xtd::collections::generic::ienumerable value type. | |
| using | const_iterator |
| Represents the const iterator of xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of enumerable value type. | |
| using | const_iterator |
| Represents the const iterator of enumerable value type. | |
| using | enumerable_type |
| Represents the ienumerable enumerable type. | |
| using | source_type |
| Represents the ienumerable source type. | |
| using | ienumerable |
| Represents the ienumerable value type. | |
| using | list |
| Represents the list value type. | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | get_hash_code () const noexcept -> xtd::usize |
| Serves as a hash function for a particular type. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| virtual auto | equals (const bit_array &) const noexcept -> bool=0 |
| Indicates whether the current object is equal to another object of the same type. | |
| virtual auto | begin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| virtual auto | cbegin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| virtual auto | cend () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| virtual auto | end () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| auto | aggregate (const std::function< bool(const bool &, const bool &)> &funcfunc) const -> bool |
| Applies an accumulator function over a sequence. | |
| auto | all (const std::function< bool(const bool &)> &predicatepredicate) const -> bool |
| Determines whether all elements of a sequence satisfy a condition. | |
| auto | any () const noexcept -> bool |
| Determines whether a sequence contains any elements. | |
| auto | append (const bool &element) const noexcept |
| Appends a value to the end of the sequence. | |
| auto | as_enumerable () const noexcept |
| Returns the input typed as xtd::collections::generic::ienumerable <type_t>. | |
| auto | average () const noexcept |
| Computes the average of a sequence of source_t values. | |
| auto | cast () const noexcept |
| Casts the elements of an xtd::collections::generic::ienumerable to the specified type. | |
| auto | chunk (xtd::usize size) const |
| Splits the elements of a sequence into chunks of size at most size. | |
| auto | concat (const ienumerable< bool > &second) const noexcept |
| Concatenates two sequences. | |
| auto | contains (const bool &value) const noexcept -> bool |
| Determines whether a sequence contains a specified element by using the default equality comparer. | |
| auto | count () const noexcept -> xtd::usize |
| Returns the number of elements in current sequence. | |
| auto | count_by (const std::function< key_t(const bool &)> &key_selector) const noexcept |
| Returns the count of elements in the current sequence grouped by key. | |
| auto | default_if_empty () const noexcept |
| Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty. | |
| auto | distinct () const noexcept |
| Returns distinct elements from a sequence by using the default equality comparer to compare values. | |
| auto | first_or_default (const std::function< bool(const bool &)> &predicatepredicate, const bool &default_value) const noexcept -> bool |
| Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found. | |
| auto | order () const |
| Sorts the elements of a sequence in ascending order. | |
| auto | order_by (const std::function< bool(const bool &)> &key_selector) const |
| Sorts the elements of a sequence in ascending order according to a key. | |
| auto | order_by_descending (const std::function< key_t(const bool &)> &key_selector) const |
| Sorts the elements of a sequence in descending order according to a key. | |
| auto | select (auto &&selector) const |
| Projects each element of a sequence into a new form. | |
| auto | to_array () const noexcept -> xtd::array< bool > |
| Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | to_list () const noexcept -> xtd::collections::generic::list< bool > |
| Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | where (auto &&predicatepredicate) const |
| Filters a sequence of values based on a predicate. | |
| virtual auto | empty () const noexcept -> bool |
| Checks whether the container is empty. | |
| virtual auto | size () const noexcept -> xtd::usize |
| Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>. | |
| virtual auto | operator<< (const bool &item) -> icollection< bool > & |
| The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>. | |
| virtual auto | operator>> (const bool &item) -> icollection< bool > & |
| The shift right operator removes the first occurrence of a specific object from the xtd::collections::generic::icollection <type_t>. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
| static auto | to_const_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
| static auto | to_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
Represents the list value type.
Represents the list base type.
Represents the list size type (usually xtd::usize).
Represents the list difference type (usually xtd::ptrdiff).
Represents the reference of list value type.
Represents the const reference of list value type.
Represents the pointer of list value type.
Represents the const pointer of list value type.
|
explicitnoexcept |
Initializes a new instance of the xtd::collections::bit_array class that can hold the specified number of bit values, which are initially set to false.
| length_ | The number of bit values in the new xtd::collections::bit_array. |
| xtd::argument_out_of_range_exception | length_ is less than 0. |
|
noexcept |
Initializes a new instance of the xtd::collections::bit_array class that can hold the specified number of bit values, which are initially set to the specified value.
| length_ | The number of bit values in the new xtd::collections::bit_array. |
| defaultValueThe | bool value to assign to each bit. |
| xtd::argument_out_of_range_exception | length_ is less than 0. |
|
noexcept |
Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified initializer list of booleans.
| values | An array of booleans to copy. |
|
noexcept |
Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified array of booleans.
| values | An initializer list of booleans to copy. |
|
noexcept |
Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified array of bytes.
| values | An array of bytes containing the values to copy, where each byte represents eight consecutive bits. |
|
noexcept |
Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified array of 32-bit integers.
| values | An array of integers containing the values to copy, where each integer represents 32 consecutive bits. |
|
inlinenoexcept |
Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified bitset.
| values | A std::bitset object that contains bit values. |
|
noexcept |
Initializes a new instance of the xtd::collections::bit_array class that contains bit values copied from the specified std::vector<bool>.
| values | A std::vector<bool> object that contains bit values. |
|
inlinenodiscardnoexcept |
Returns a std::bitset object containing the Booleans contained in the current xtd::collections::bit_array.
|
inlinenodiscardnoexcept |
Returns a std::vector<bool> object containing the Booleans contained in the current xtd::collections::bit_array.
|
nodiscardoverridevirtualnoexcept |
Gets the number of elements contained in the xtd::collections::bit_array.
Implements xtd::collections::generic::icollection< bool >.
|
nodiscardnoexcept |
Gets the number of elements contained in the xtd::collections::bit_array.
| auto xtd::collections::bit_array::length | ( | xtd::usize | value | ) | -> void |
Sets the number of elements contained in the xtd::collections::bit_array.
| value | The number of elements contained in the xtd::collections::bit_array. |
Performs the bitwise AND operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise AND operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
|
nodiscardoverridevirtual |
Creates a new object that is a copy of the current instance.
Implements xtd::iclonable.
|
overridevirtual |
Copies the elements of the xtd::collections::bit_array to an xtd::array, starting at a particular xtd::array index.
| array | The one-dimensional xtd::array that is the destination of the elements copied from xtd::collections::bit_array. The xtd::array must have zero-based indexing. |
| index | The zero-based index in array at which copying begins; |
Implements xtd::collections::generic::icollection< bool >.
|
nodiscardoverridenoexcept |
Determines whether this instance of xtd::collections::bit_array and a specified object, which must also be a xtd::collections::bit_array object, have the same value.
| value | The xtd::collections::bit_array to compare with the current object. |
|
nodiscardoverridevirtualnoexcept |
Determines whether this instance of xtd::collections::bit_array and a specified object, which must also be a xtd::collections::bit_array object, have the same value.
| obj | The object to compare with the current object. |
Reimplemented from xtd::object.
|
nodiscard |
Gets the value of the bit at a specific position in the xtd::collections::bit_array.
| index | The zero-based index of the value to get. |
| xtd::argument_out_of_range_exception | index is less than zero. -or- index is greater than or equal to the number of elements in the xtd::collections::bit_array. |
|
nodiscard |
Gets the value of the bit at a specific position in the xtd::collections::bit_array.
| index | The zero-based index of the value to get. |
| xtd::argument_out_of_range_exception | index is less than zero. -or- index is greater than or equal to the number of elements in the xtd::collections::bit_array. |
|
nodiscardoverridevirtual |
Returns an enumerator that iterates through a collection.
Implements xtd::collections::generic::icollection< bool >.
|
nodiscardnoexcept |
Determines whether all bits in the xtd::collections::bit_array are set to true.
|
nodiscardnoexcept |
Determines whether any bit in the xtd::collections::bit_array is set to true.
|
noexcept |
Shifts all the bit values of the current xtd::collections::bit_array to the left on count bits.
| count | The number of shifts to make for each bit. |
| auto xtd::collections::bit_array::not_ | ( | ) | -> const bit_array & |
Inverts all the bit values in the current xtd::collections::bit_array, so that elements set to true are changed to false, and elements set to false are changed to true.
Performs the bitwise OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise OR operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
|
noexcept |
Shifts all the bit values of the current xtd::collections::bit_array to the right on count bits.
| count | The number of shifts to make for each bit. |
| auto xtd::collections::bit_array::set | ( | xtd::usize | index, |
| bool | value ) -> void |
Sets the value of the bit at a specific position in the xtd::collections::bit_array.
| index | The zero-based index of the value to get. |
| value | The bool value to assign to the bit. |
| xtd::argument_out_of_range_exception | index is less than zero. -or- index is greater than or equal to the number of elements in the xtd::collections::bit_array. |
| auto xtd::collections::bit_array::set_all | ( | bool | value | ) | -> void |
Sets all bits in the xtd::collections::bit_array to the specified value.
| value | The bool value to assign to all bits. |
|
nodiscardoverridevirtualnoexcept |
Returns a xtd::string that represents the current object.
Reimplemented from xtd::object.
Performs the bitwise exclusive OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise exclusive OR operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
| auto xtd::collections::bit_array::operator[] | ( | xtd::usize | index | ) | const -> const bool & |
Gets the element at the specified index.
| index | The zero-based index of the element to get. |
| xtd::argument_out_of_range_exception | index is less than 0 or index is equal to or greater than count. |
| auto xtd::collections::bit_array::operator[] | ( | xtd::usize | index | ) | -> bool & |
Gets or Sets the element at the specified index.
| index | The zero-based index of the element to get. |
| xtd::argument_out_of_range_exception | index is less than 0 or index is equal to or greater than count. |
Performs the bitwise AND operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise AND operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
Performs the bitwise AND operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise AND operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
Performs the bitwise OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise OR operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
Performs the bitwise OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise OR operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
Performs the bitwise exclusive OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise exclusive OR operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
Performs the bitwise exclusive OR operation on the elements in the current xtd::collections::bit_array against the corresponding elements in the specified xtd::collections::bit_array.
| value | The xtd::collections::bit_array with which to perform the bitwise exclusive OR operation. |
| xtd::argument_exception | value and the current xtd::collections::bit_array do not have the same number of elements. |
| auto xtd::collections::bit_array::operator~ | ( | ) | const -> bit_array |
Inverts all the bit values in the current xtd::collections::bit_array, so that elements set to true are changed to false, and elements set to false are changed to true.
|
noexcept |
The right shift operator shifts all the bit values of the current xtd::collections::bit_array to the right on count bits.
| count | The number of shifts to make for each bit. |
|
noexcept |
The right shift operator shifts all the bit values of the current xtd::collections::bit_array to the right on count bits.
| count | The number of shifts to make for each bit. |
|
noexcept |
The left shift operator shifts all the bit values of the current xtd::collections::bit_array to the left on count bits.
| count | The number of shifts to make for each bit. |
|
noexcept |
The left shift operator shifts all the bit values of the current xtd::collections::bit_array to the left on count bits.
| count | The number of shifts to make for each bit. |