Struct qt_gui::QVectorOfU64
source · #[repr(C)]pub struct QVectorOfU64 { /* private fields */ }
Expand description
The QVector class is a template class that provides a dynamic array.
C++ class: QVector<GLuint64>
.
The QVector class is a template class that provides a dynamic array.
QVector<T> is one of Qt's generic container classes. It stores its items in adjacent memory locations and provides fast index-based access.
QList<T>, QLinkedList<T>, QVector<T>, and QVarLengthArray<T> provide similar APIs and functionality. They are often interchangeable, but there are performance consequences. Here is an overview of use cases:
- QVector should be your default first choice. QVector<T> will usually give better performance than QList<T>, because QVector<T> always stores its items sequentially in memory, where QList<T> will allocate its items on the heap unless
sizeof(T) <= sizeof(void*)
and T has been declared to be either aQ_MOVABLE_TYPE
or aQ_PRIMITIVE_TYPE
using Q_DECLARE_TYPEINFO. See the Pros and Cons of Using QList for an explanation. - However, QList is used throughout the Qt APIs for passing parameters and for returning values. Use QList to interface with those APIs.
- If you need a real linked list, which guarantees constant time insertions mid-list and uses iterators to items rather than indexes, use QLinkedList.
Note: QVector and QVarLengthArray both guarantee C-compatible array layout. QList does not. This might be important if your application must interface with a C API.
Note: Iterators into a QLinkedList and references into heap-allocating QLists remain valid as long as the referenced items remain in the container. This is not true for iterators and references into a QVector and non-heap-allocating QLists.
Here's an example of a QVector that stores integers and a QVector that stores QString values:
QVector stores its items in a vector (array). Typically, vectors are created with an initial size. For example, the following code constructs a QVector with 200 elements:
The elements are automatically initialized with a default-constructed value. If you want to initialize the vector with a different value, pass that value as the second argument to the constructor:
You can also call fill() at any time to fill the vector with a value.
QVector uses 0-based indexes, just like C++ arrays. To access the item at a particular index position, you can use operator[](). On non-const vectors, operator[]() returns a reference to the item that can be used on the left side of an assignment:
if (vector[0] == “Liz”) vector[0] = “Elizabeth”;
For read-only access, an alternative syntax is to use at():
for (int i = 0; i < vector.size(); ++i) { if (vector.at(i) == “Alfonso”) cout << “Found Alfonso at position “ << i << endl; }
at() can be faster than operator[](), because it never causes a deep copy to occur.
Another way to access the data stored in a QVector is to call data(). The function returns a pointer to the first item in the vector. You can use the pointer to directly access and modify the elements stored in the vector. The pointer is also useful if you need to pass a QVector to a function that accepts a plain C++ array.
If you want to find all occurrences of a particular value in a vector, use indexOf() or lastIndexOf(). The former searches forward starting from a given index position, the latter searches backward. Both return the index of the matching item if they found one; otherwise, they return -1. For example:
int i = vector.indexOf(“Harumi”); if (i != -1) cout << “First occurrence of Harumi is at position “ << i << endl;
If you simply want to check whether a vector contains a particular value, use contains(). If you want to find out how many times a particular value occurs in the vector, use count().
QVector provides these basic functions to add, move, and remove items: insert(), replace(), remove(), prepend(), append(). With the exception of append() and replace(), these functions can be slow (linear time) for large vectors, because they require moving many items in the vector by one position in memory. If you want a container class that provides fast insertion/removal in the middle, use QList or QLinkedList instead.
Unlike plain C++ arrays, QVectors can be resized at any time by calling resize(). If the new size is larger than the old size, QVector might need to reallocate the whole vector. QVector tries to reduce the number of reallocations by preallocating up to twice as much memory as the actual data needs.
If you know in advance approximately how many items the QVector will contain, you can call reserve(), asking QVector to preallocate a certain amount of memory. You can also call capacity() to find out how much memory QVector actually allocated.
Note that using non-const operators and functions can cause QVector to do a deep copy of the data. This is due to implicit sharing.
QVector's value type must be an assignable data type. This covers most data types that are commonly used, but the compiler won't let you, for example, store a QWidget as a value; instead, store a QWidget *. A few functions have additional requirements; for example, indexOf() and lastIndexOf() expect the value type to support operator==()
. These requirements are documented on a per-function basis.
Like the other container classes, QVector provides Java-style iterators (QVectorIterator and QMutableVectorIterator) and STL-style iterators (QVector::const_iterator and QVector::iterator). In practice, these are rarely used, because you can use indexes into the QVector.
In addition to QVector, Qt also provides QVarLengthArray, a very low-level class with little functionality that is optimized for speed.
QVector does not support inserting, prepending, appending or replacing with references to its own values. Doing so will cause your application to abort with an error message.
More Information on Using Qt Containers
For a detailed discussion comparing Qt containers with each other and with STL containers, see Understand the Qt Containers.
Implementations§
source§impl QVectorOfU64
impl QVectorOfU64
sourcepub unsafe fn add_assign_q_vector_of_u64(
&self,
l: impl CastInto<Ref<QVectorOfU64>>
) -> Ref<QVectorOfU64>
pub unsafe fn add_assign_q_vector_of_u64( &self, l: impl CastInto<Ref<QVectorOfU64>> ) -> Ref<QVectorOfU64>
Appends the items of the other vector to this vector and returns a reference to this vector.
Calls C++ function: QVector<GLuint64>& QVector<GLuint64>::operator+=(const QVector<GLuint64>& l)
.
sourcepub unsafe fn add_assign_u64(&self, t: *const u64) -> Ref<QVectorOfU64>
pub unsafe fn add_assign_u64(&self, t: *const u64) -> Ref<QVectorOfU64>
This is an overloaded function.
Calls C++ function: QVector<GLuint64>& QVector<GLuint64>::operator+=(const GLuint64& t)
.
sourcepub unsafe fn append_u64(&self, t: *const u64)
pub unsafe fn append_u64(&self, t: *const u64)
Inserts value at the end of the vector.
Calls C++ function: void QVector<GLuint64>::append(const GLuint64& t)
.
Inserts value at the end of the vector.
Example:
QVector<QString> vector; vector.append(“one”); vector.append(“two”); QString three = “three”; vector.append(three); // vector: [“one”, “two”, “three”] // three: “three”
This is the same as calling resize(size() + 1) and assigning value to the new last element in the vector.
This operation is relatively fast, because QVector typically allocates more memory than necessary, so it can grow without reallocating the entire vector each time.
See also operator<<(), prepend(), and insert().
sourcepub unsafe fn append_q_vector_of_u64(&self, l: impl CastInto<Ref<QVectorOfU64>>)
pub unsafe fn append_q_vector_of_u64(&self, l: impl CastInto<Ref<QVectorOfU64>>)
This is an overloaded function.
Calls C++ function: void QVector<GLuint64>::append(const QVector<GLuint64>& l)
.
This is an overloaded function.
Appends the items of the value vector to this vector.
This function was introduced in Qt 5.5.
See also operator<<() and operator+=().
sourcepub unsafe fn at(&self, i: c_int) -> *const u64
pub unsafe fn at(&self, i: c_int) -> *const u64
Returns the item at index position i in the vector.
Calls C++ function: const GLuint64& QVector<GLuint64>::at(int i) const
.
Returns the item at index position i in the vector.
i must be a valid index position in the vector (i.e., 0 <= i < size()).
See also value() and operator[]().
sourcepub unsafe fn back_mut(&self) -> *mut u64
pub unsafe fn back_mut(&self) -> *mut u64
sourcepub unsafe fn back(&self) -> *const u64
pub unsafe fn back(&self) -> *const u64
This is an overloaded function.
Calls C++ function: const GLuint64& QVector<GLuint64>::back() const
.
This is an overloaded function.
sourcepub unsafe fn capacity(&self) -> c_int
pub unsafe fn capacity(&self) -> c_int
Returns the maximum number of items that can be stored in the vector without forcing a reallocation.
Calls C++ function: int QVector<GLuint64>::capacity() const
.
Returns the maximum number of items that can be stored in the vector without forcing a reallocation.
The sole purpose of this function is to provide a means of fine tuning QVector's memory usage. In general, you will rarely ever need to call this function. If you want to know how many items are in the vector, call size().
sourcepub unsafe fn clear(&self)
pub unsafe fn clear(&self)
Removes all the elements from the vector.
Calls C++ function: void QVector<GLuint64>::clear()
.
Removes all the elements from the vector.
Note: Until Qt 5.6, this also released the memory used by the vector. From Qt 5.7, the capacity is preserved. To shed all capacity, swap with a default-constructed vector:
QVector<T> v ...; QVector<T>().swap(v); Q_ASSERT(v.capacity() == 0);
or call squeeze().
See also squeeze().
sourcepub unsafe fn const_data(&self) -> *const u64
pub unsafe fn const_data(&self) -> *const u64
Returns a const pointer to the data stored in the vector. The pointer can be used to access the items in the vector. The pointer remains valid as long as the vector isn't reallocated.
Calls C++ function: const GLuint64* QVector<GLuint64>::constData() const
.
Returns a const pointer to the data stored in the vector. The pointer can be used to access the items in the vector. The pointer remains valid as long as the vector isn’t reallocated.
This function is mostly useful to pass a vector to a function that accepts a plain C++ array.
See also data() and operator[]().
sourcepub unsafe fn const_first(&self) -> *const u64
pub unsafe fn const_first(&self) -> *const u64
Returns a const reference to the first item in the vector. This function assumes that the vector isn't empty.
Calls C++ function: const GLuint64& QVector<GLuint64>::constFirst() const
.
sourcepub unsafe fn const_last(&self) -> *const u64
pub unsafe fn const_last(&self) -> *const u64
Returns a const reference to the last item in the vector. This function assumes that the vector isn't empty.
Calls C++ function: const GLuint64& QVector<GLuint64>::constLast() const
.
Returns a const reference to the last item in the vector. This function assumes that the vector isn’t empty.
This function was introduced in Qt 5.6.
See also constFirst(), isEmpty(), and last().
sourcepub unsafe fn contains(&self, t: *const u64) -> bool
pub unsafe fn contains(&self, t: *const u64) -> bool
Returns true
if the vector contains an occurrence of value; otherwise returns false
.
Calls C++ function: bool QVector<GLuint64>::contains(const GLuint64& t) const
.
sourcepub unsafe fn copy_from(
&self,
v: impl CastInto<Ref<QVectorOfU64>>
) -> Ref<QVectorOfU64>
pub unsafe fn copy_from( &self, v: impl CastInto<Ref<QVectorOfU64>> ) -> Ref<QVectorOfU64>
Assigns other to this vector and returns a reference to this vector.
Calls C++ function: QVector<GLuint64>& QVector<GLuint64>::operator=(const QVector<GLuint64>& v)
.
Assigns other to this vector and returns a reference to this vector.
sourcepub unsafe fn count_1a(&self, t: *const u64) -> c_int
pub unsafe fn count_1a(&self, t: *const u64) -> c_int
Returns the number of occurrences of value in the vector.
Calls C++ function: int QVector<GLuint64>::count(const GLuint64& t) const
.
sourcepub unsafe fn count_0a(&self) -> c_int
pub unsafe fn count_0a(&self) -> c_int
This is an overloaded function.
Calls C++ function: int QVector<GLuint64>::count() const
.
This is an overloaded function.
Same as size().
sourcepub unsafe fn data_mut(&self) -> *mut u64
pub unsafe fn data_mut(&self) -> *mut u64
Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector.
Calls C++ function: GLuint64* QVector<GLuint64>::data()
.
Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector.
Example:
QVector<int> vector(10); int data = vector.data(); for (int i = 0; i < 10; ++i) data[i] = 2 i;
The pointer remains valid as long as the vector isn't reallocated.
This function is mostly useful to pass a vector to a function that accepts a plain C++ array.
See also constData() and operator[]().
sourcepub unsafe fn data(&self) -> *const u64
pub unsafe fn data(&self) -> *const u64
This is an overloaded function.
Calls C++ function: const GLuint64* QVector<GLuint64>::data() const
.
This is an overloaded function.
sourcepub unsafe fn empty(&self) -> bool
pub unsafe fn empty(&self) -> bool
This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true
if the vector is empty; otherwise returns false
.
Calls C++ function: bool QVector<GLuint64>::empty() const
.
This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true
if the vector is empty; otherwise returns false
.
sourcepub unsafe fn ends_with(&self, t: *const u64) -> bool
pub unsafe fn ends_with(&self, t: *const u64) -> bool
Returns true
if this vector is not empty and its last item is equal to value; otherwise returns false
.
Calls C++ function: bool QVector<GLuint64>::endsWith(const GLuint64& t) const
.
sourcepub unsafe fn fill_2a(&self, t: *const u64, size: c_int) -> Ref<QVectorOfU64>
pub unsafe fn fill_2a(&self, t: *const u64, size: c_int) -> Ref<QVectorOfU64>
Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.
Calls C++ function: QVector<GLuint64>& QVector<GLuint64>::fill(const GLuint64& t, int size = …)
.
Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.
Example:
QVector<QString> vector(3); vector.fill(“Yes”); // vector: [“Yes”, “Yes”, “Yes”]
vector.fill(“oh”, 5); // vector: [“oh”, “oh”, “oh”, “oh”, “oh”]
See also resize().
sourcepub unsafe fn fill_1a(&self, t: *const u64) -> Ref<QVectorOfU64>
pub unsafe fn fill_1a(&self, t: *const u64) -> Ref<QVectorOfU64>
Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.
Calls C++ function: QVector<GLuint64>& QVector<GLuint64>::fill(const GLuint64& t)
.
Assigns value to all items in the vector. If size is different from -1 (the default), the vector is resized to size size beforehand.
Example:
QVector<QString> vector(3); vector.fill(“Yes”); // vector: [“Yes”, “Yes”, “Yes”]
vector.fill(“oh”, 5); // vector: [“oh”, “oh”, “oh”, “oh”, “oh”]
See also resize().
sourcepub unsafe fn first_mut(&self) -> *mut u64
pub unsafe fn first_mut(&self) -> *mut u64
Returns a reference to the first item in the vector. This function assumes that the vector isn't empty.
Calls C++ function: GLuint64& QVector<GLuint64>::first()
.
Returns a reference to the first item in the vector. This function assumes that the vector isn’t empty.
See also last(), isEmpty(), and constFirst().
sourcepub unsafe fn first(&self) -> *const u64
pub unsafe fn first(&self) -> *const u64
This is an overloaded function.
Calls C++ function: const GLuint64& QVector<GLuint64>::first() const
.
This is an overloaded function.
sourcepub unsafe fn front_mut(&self) -> *mut u64
pub unsafe fn front_mut(&self) -> *mut u64
sourcepub unsafe fn front(&self) -> *const u64
pub unsafe fn front(&self) -> *const u64
This is an overloaded function.
Calls C++ function: const GLuint64& QVector<GLuint64>::front() const
.
This is an overloaded function.
sourcepub unsafe fn index_mut(&self, i: c_int) -> *mut u64
pub unsafe fn index_mut(&self, i: c_int) -> *mut u64
Returns the item at index position i as a modifiable reference.
Calls C++ function: GLuint64& QVector<GLuint64>::operator[](int i)
.
sourcepub unsafe fn index(&self, i: c_int) -> *const u64
pub unsafe fn index(&self, i: c_int) -> *const u64
This is an overloaded function.
Calls C++ function: const GLuint64& QVector<GLuint64>::operator[](int i) const
.
This is an overloaded function.
Same as at(i).
sourcepub unsafe fn index_of_2a(&self, t: *const u64, from: c_int) -> c_int
pub unsafe fn index_of_2a(&self, t: *const u64, from: c_int) -> c_int
Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.
Calls C++ function: int QVector<GLuint64>::indexOf(const GLuint64& t, int from = …) const
.
Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.
Example:
QVector<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.indexOf(“B”); // returns 1 vector.indexOf(“B”, 1); // returns 1 vector.indexOf(“B”, 2); // returns 3 vector.indexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
See also lastIndexOf() and contains().
sourcepub unsafe fn index_of_1a(&self, t: *const u64) -> c_int
pub unsafe fn index_of_1a(&self, t: *const u64) -> c_int
Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.
Calls C++ function: int QVector<GLuint64>::indexOf(const GLuint64& t) const
.
Returns the index position of the first occurrence of value in the vector, searching forward from index position from. Returns -1 if no item matched.
Example:
QVector<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.indexOf(“B”); // returns 1 vector.indexOf(“B”, 1); // returns 1 vector.indexOf(“B”, 2); // returns 3 vector.indexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
See also lastIndexOf() and contains().
sourcepub unsafe fn insert_2a(&self, i: c_int, t: *const u64)
pub unsafe fn insert_2a(&self, i: c_int, t: *const u64)
Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.
Calls C++ function: void QVector<GLuint64>::insert(int i, const GLuint64& t)
.
Inserts value at index position i in the vector. If i is 0, the value is prepended to the vector. If i is size(), the value is appended to the vector.
Example:
QVector<QString> vector; vector << “alpha” << “beta” << “delta”; vector.insert(2, “gamma”); // vector: [“alpha”, “beta”, “gamma”, “delta”]
For large vectors, this operation can be slow (linear time), because it requires moving all the items at indexes i and above by one position further in memory. If you want a container class that provides a fast insert() function, use QLinkedList instead.
sourcepub unsafe fn insert_3a(&self, i: c_int, n: c_int, t: *const u64)
pub unsafe fn insert_3a(&self, i: c_int, n: c_int, t: *const u64)
This is an overloaded function.
Calls C++ function: void QVector<GLuint64>::insert(int i, int n, const GLuint64& t)
.
This is an overloaded function.
Inserts count copies of value at index position i in the vector.
Example:
QVector<double> vector; vector << 2.718 << 1.442 << 0.4342; vector.insert(1, 3, 9.9); // vector: [2.718, 9.9, 9.9, 9.9, 1.442, 0.4342]
sourcepub unsafe fn is_detached(&self) -> bool
pub unsafe fn is_detached(&self) -> bool
Calls C++ function: bool QVector<GLuint64>::isDetached() const
.
sourcepub unsafe fn is_empty(&self) -> bool
pub unsafe fn is_empty(&self) -> bool
Returns true
if the vector has size 0; otherwise returns false
.
Calls C++ function: bool QVector<GLuint64>::isEmpty() const
.
Calls C++ function: bool QVector<GLuint64>::isSharedWith(const QVector<GLuint64>& other) const
.
sourcepub unsafe fn last_mut(&self) -> *mut u64
pub unsafe fn last_mut(&self) -> *mut u64
Returns a reference to the last item in the vector. This function assumes that the vector isn't empty.
Calls C++ function: GLuint64& QVector<GLuint64>::last()
.
sourcepub unsafe fn last(&self) -> *const u64
pub unsafe fn last(&self) -> *const u64
This is an overloaded function.
Calls C++ function: const GLuint64& QVector<GLuint64>::last() const
.
This is an overloaded function.
sourcepub unsafe fn last_index_of_2a(&self, t: *const u64, from: c_int) -> c_int
pub unsafe fn last_index_of_2a(&self, t: *const u64, from: c_int) -> c_int
Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Calls C++ function: int QVector<GLuint64>::lastIndexOf(const GLuint64& t, int from = …) const
.
Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Example:
QList<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.lastIndexOf(“B”); // returns 3 vector.lastIndexOf(“B”, 3); // returns 3 vector.lastIndexOf(“B”, 2); // returns 1 vector.lastIndexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
See also indexOf().
sourcepub unsafe fn last_index_of_1a(&self, t: *const u64) -> c_int
pub unsafe fn last_index_of_1a(&self, t: *const u64) -> c_int
Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Calls C++ function: int QVector<GLuint64>::lastIndexOf(const GLuint64& t) const
.
Returns the index position of the last occurrence of the value value in the vector, searching backward from index position from. If from is -1 (the default), the search starts at the last item. Returns -1 if no item matched.
Example:
QList<QString> vector; vector << “A” << “B” << “C” << “B” << “A”; vector.lastIndexOf(“B”); // returns 3 vector.lastIndexOf(“B”, 3); // returns 3 vector.lastIndexOf(“B”, 2); // returns 1 vector.lastIndexOf(“X”); // returns -1
This function requires the value type to have an implementation of operator==()
.
See also indexOf().
sourcepub unsafe fn length(&self) -> c_int
pub unsafe fn length(&self) -> c_int
Calls C++ function: int QVector<GLuint64>::length() const
.
sourcepub unsafe fn mid_2a(&self, pos: c_int, len: c_int) -> CppBox<QVectorOfU64>
pub unsafe fn mid_2a(&self, pos: c_int, len: c_int) -> CppBox<QVectorOfU64>
Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
Calls C++ function: QVector<GLuint64> QVector<GLuint64>::mid(int pos, int len = …) const
.
Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
sourcepub unsafe fn mid_1a(&self, pos: c_int) -> CppBox<QVectorOfU64>
pub unsafe fn mid_1a(&self, pos: c_int) -> CppBox<QVectorOfU64>
Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
Calls C++ function: QVector<GLuint64> QVector<GLuint64>::mid(int pos) const
.
Returns a sub-vector which contains elements from this vector, starting at position pos. If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.
sourcepub unsafe fn move_(&self, from: c_int, to: c_int)
pub unsafe fn move_(&self, from: c_int, to: c_int)
Moves the item at index position from to index position to.
Calls C++ function: void QVector<GLuint64>::move(int from, int to)
.
Moves the item at index position from to index position to.
Provided for compatibility with QList.
This function was introduced in Qt 5.6.
See also QList::move().
sourcepub unsafe fn new_0a() -> CppBox<QVectorOfU64>
pub unsafe fn new_0a() -> CppBox<QVectorOfU64>
Constructs an empty vector.
Calls C++ function: [constructor] void QVector<GLuint64>::QVector()
.
Constructs an empty vector.
See also resize().
sourcepub unsafe fn new_1a(size: c_int) -> CppBox<QVectorOfU64>
pub unsafe fn new_1a(size: c_int) -> CppBox<QVectorOfU64>
Constructs a vector with an initial size of size elements.
Calls C++ function: [constructor] void QVector<GLuint64>::QVector(int size)
.
Constructs a vector with an initial size of size elements.
The elements are initialized with a default-constructed value.
See also resize().
sourcepub unsafe fn new_2a(size: c_int, t: *const u64) -> CppBox<QVectorOfU64>
pub unsafe fn new_2a(size: c_int, t: *const u64) -> CppBox<QVectorOfU64>
Constructs a vector with an initial size of size elements. Each element is initialized with value.
Calls C++ function: [constructor] void QVector<GLuint64>::QVector(int size, const GLuint64& t)
.
sourcepub unsafe fn new_copy(
v: impl CastInto<Ref<QVectorOfU64>>
) -> CppBox<QVectorOfU64>
pub unsafe fn new_copy( v: impl CastInto<Ref<QVectorOfU64>> ) -> CppBox<QVectorOfU64>
Constructs a copy of other.
Calls C++ function: [constructor] void QVector<GLuint64>::QVector(const QVector<GLuint64>& v)
.
Constructs a copy of other.
This operation takes constant time, because QVector is implicitly shared. This makes returning a QVector from a function very fast. If a shared instance is modified, it will be copied (copy-on-write), and that takes linear time.
See also operator=().
sourcepub unsafe fn pop_back(&self)
pub unsafe fn pop_back(&self)
This function is provided for STL compatibility. It is equivalent to removeLast().
Calls C++ function: void QVector<GLuint64>::pop_back()
.
This function is provided for STL compatibility. It is equivalent to removeLast().
sourcepub unsafe fn pop_front(&self)
pub unsafe fn pop_front(&self)
This function is provided for STL compatibility. It is equivalent to removeFirst().
Calls C++ function: void QVector<GLuint64>::pop_front()
.
This function is provided for STL compatibility. It is equivalent to removeFirst().
sourcepub unsafe fn prepend(&self, t: *const u64)
pub unsafe fn prepend(&self, t: *const u64)
Inserts value at the beginning of the vector.
Calls C++ function: void QVector<GLuint64>::prepend(const GLuint64& t)
.
Inserts value at the beginning of the vector.
Example:
QVector<QString> vector; vector.prepend(“one”); vector.prepend(“two”); vector.prepend(“three”); // vector: [“three”, “two”, “one”]
This is the same as vector.insert(0, value).
For large vectors, this operation can be slow (linear time), because it requires moving all the items in the vector by one position further in memory. If you want a container class that provides a fast prepend() function, use QList or QLinkedList instead.
sourcepub unsafe fn push_back(&self, t: *const u64)
pub unsafe fn push_back(&self, t: *const u64)
This function is provided for STL compatibility. It is equivalent to append(value).
Calls C++ function: void QVector<GLuint64>::push_back(const GLuint64& t)
.
This function is provided for STL compatibility. It is equivalent to append(value).
sourcepub unsafe fn push_front(&self, t: *const u64)
pub unsafe fn push_front(&self, t: *const u64)
This function is provided for STL compatibility. It is equivalent to prepend(value).
Calls C++ function: void QVector<GLuint64>::push_front(const GLuint64& t)
.
This function is provided for STL compatibility. It is equivalent to prepend(value).
sourcepub unsafe fn remove_1a(&self, i: c_int)
pub unsafe fn remove_1a(&self, i: c_int)
This is an overloaded function.
Calls C++ function: void QVector<GLuint64>::remove(int i)
.
sourcepub unsafe fn remove_2a(&self, i: c_int, n: c_int)
pub unsafe fn remove_2a(&self, i: c_int, n: c_int)
This is an overloaded function.
Calls C++ function: void QVector<GLuint64>::remove(int i, int n)
.
sourcepub unsafe fn remove_all(&self, t: *const u64) -> c_int
pub unsafe fn remove_all(&self, t: *const u64) -> c_int
Removes all elements that compare equal to t from the vector. Returns the number of elements removed, if any.
Calls C++ function: int QVector<GLuint64>::removeAll(const GLuint64& t)
.
Removes all elements that compare equal to t from the vector. Returns the number of elements removed, if any.
Provided for compatibility with QList.
This function was introduced in Qt 5.4.
See also removeOne() and QList::removeAll().
sourcepub unsafe fn remove_at(&self, i: c_int)
pub unsafe fn remove_at(&self, i: c_int)
Removes the element at index position i. Equivalent to
Calls C++ function: void QVector<GLuint64>::removeAt(int i)
.
Removes the element at index position i. Equivalent to
remove(i);
Provided for compatibility with QList.
This function was introduced in Qt 5.2.
See also remove() and QList::removeAt().
sourcepub unsafe fn remove_first(&self)
pub unsafe fn remove_first(&self)
Removes the first item in the vector. Calling this function is equivalent to calling remove(0). The vector must not be empty. If the vector can be empty, call isEmpty() before calling this function.
Calls C++ function: void QVector<GLuint64>::removeFirst()
.
sourcepub unsafe fn remove_last(&self)
pub unsafe fn remove_last(&self)
Removes the last item in the vector. Calling this function is equivalent to calling remove(size() - 1). The vector must not be empty. If the vector can be empty, call isEmpty() before calling this function.
Calls C++ function: void QVector<GLuint64>::removeLast()
.
Removes the last item in the vector. Calling this function is equivalent to calling remove(size() - 1). The vector must not be empty. If the vector can be empty, call isEmpty() before calling this function.
This function was introduced in Qt 5.1.
See also remove(), takeLast(), removeFirst(), and isEmpty().
sourcepub unsafe fn remove_one(&self, t: *const u64) -> bool
pub unsafe fn remove_one(&self, t: *const u64) -> bool
Removes the first element that compares equal to t from the vector. Returns whether an element was, in fact, removed.
Calls C++ function: bool QVector<GLuint64>::removeOne(const GLuint64& t)
.
Removes the first element that compares equal to t from the vector. Returns whether an element was, in fact, removed.
Provided for compatibility with QList.
This function was introduced in Qt 5.4.
See also removeAll() and QList::removeOne().
sourcepub unsafe fn replace(&self, i: c_int, t: *const u64)
pub unsafe fn replace(&self, i: c_int, t: *const u64)
Replaces the item at index position i with value.
Calls C++ function: void QVector<GLuint64>::replace(int i, const GLuint64& t)
.
Replaces the item at index position i with value.
i must be a valid index position in the vector (i.e., 0 <= i < size()).
See also operator[]() and remove().
sourcepub unsafe fn reserve(&self, size: c_int)
pub unsafe fn reserve(&self, size: c_int)
Attempts to allocate memory for at least size elements. If you know in advance how large the vector will be, you should call this function to prevent reallocations and memory fragmentation.
Calls C++ function: void QVector<GLuint64>::reserve(int size)
.
Attempts to allocate memory for at least size elements. If you know in advance how large the vector will be, you should call this function to prevent reallocations and memory fragmentation.
If size is an underestimate, the worst that will happen is that the QVector will be a bit slower. If size is an overestimate, you may have used more memory than the normal QVector growth strategy would have allocated—or you may have used less.
An alternative to reserve() is calling resize(). Whether or not that is faster than reserve() depends on the element type, because resize() default-constructs all elements, and requires assignment to existing entries rather than calling append(), which copy- or move-constructs. For simple types, like int
or double
, resize() is typically faster, but for anything more complex, you should prefer reserve().
Warning: If the size passed to resize() was underestimated, you run out of allocated space and into undefined behavior. This problem does not exist with reserve(), because it treats the size as just a hint.
sourcepub unsafe fn resize(&self, size: c_int)
pub unsafe fn resize(&self, size: c_int)
Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.
Calls C++ function: void QVector<GLuint64>::resize(int size)
.
Sets the size of the vector to size. If size is greater than the current size, elements are added to the end; the new elements are initialized with a default-constructed value. If size is less than the current size, elements are removed from the end.
Since Qt 5.6, resize() doesn't shrink the capacity anymore. To shed excess capacity, use squeeze().
See also size().
sourcepub unsafe fn set_sharable(&self, sharable: bool)
pub unsafe fn set_sharable(&self, sharable: bool)
Calls C++ function: void QVector<GLuint64>::setSharable(bool sharable)
.
sourcepub unsafe fn shrink_to_fit(&self)
Available on cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn shrink_to_fit(&self)
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.sourcepub unsafe fn size(&self) -> c_int
pub unsafe fn size(&self) -> c_int
Returns the number of items in the vector.
Calls C++ function: int QVector<GLuint64>::size() const
.
sourcepub unsafe fn squeeze(&self)
pub unsafe fn squeeze(&self)
Releases any memory not required to store the items.
Calls C++ function: void QVector<GLuint64>::squeeze()
.
sourcepub unsafe fn starts_with(&self, t: *const u64) -> bool
pub unsafe fn starts_with(&self, t: *const u64) -> bool
Returns true
if this vector is not empty and its first item is equal to value; otherwise returns false
.
Calls C++ function: bool QVector<GLuint64>::startsWith(const GLuint64& t) const
.
sourcepub unsafe fn swap(&self, other: impl CastInto<Ref<QVectorOfU64>>)
pub unsafe fn swap(&self, other: impl CastInto<Ref<QVectorOfU64>>)
Swaps vector other with this vector. This operation is very fast and never fails.
Calls C++ function: void QVector<GLuint64>::swap(QVector<GLuint64>& other)
.
Swaps vector other with this vector. This operation is very fast and never fails.
This function was introduced in Qt 4.8.
sourcepub unsafe fn swap_items_at(&self, i: c_int, j: c_int)
Available on cpp_lib_version="5.14.0"
only.
pub unsafe fn swap_items_at(&self, i: c_int, j: c_int)
cpp_lib_version="5.14.0"
only.sourcepub unsafe fn take_at(&self, i: c_int) -> u64
pub unsafe fn take_at(&self, i: c_int) -> u64
Removes the element at index position i and returns it.
Calls C++ function: GLuint64 QVector<GLuint64>::takeAt(int i)
.
Removes the element at index position i and returns it.
Equivalent to
T t = at(i); remove(i); return t;
Provided for compatibility with QList.
This function was introduced in Qt 5.2.
See also takeFirst(), takeLast(), and QList::takeAt().
sourcepub unsafe fn take_first(&self) -> u64
pub unsafe fn take_first(&self) -> u64
Removes the first item in the vector and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.
Calls C++ function: GLuint64 QVector<GLuint64>::takeFirst()
.
Removes the first item in the vector and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.
This function was introduced in Qt 5.1.
See also takeLast() and removeFirst().
sourcepub unsafe fn take_last(&self) -> u64
pub unsafe fn take_last(&self) -> u64
Removes the last item in the list and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.
Calls C++ function: GLuint64 QVector<GLuint64>::takeLast()
.
Removes the last item in the list and returns it. This function assumes the vector is not empty. To avoid failure, call isEmpty() before calling this function.
If you don't use the return value, removeLast() is more efficient.
This function was introduced in Qt 5.1.
See also takeFirst() and removeLast().
sourcepub unsafe fn value_1a(&self, i: c_int) -> u64
pub unsafe fn value_1a(&self, i: c_int) -> u64
Returns the value at index position i in the vector.
Calls C++ function: GLuint64 QVector<GLuint64>::value(int i) const
.
Returns the value at index position i in the vector.
If the index i is out of bounds, the function returns a default-constructed value. If you are certain that i is within bounds, you can use at() instead, which is slightly faster.
See also at() and operator[]().
sourcepub unsafe fn value_2a(&self, i: c_int, default_value: *const u64) -> u64
pub unsafe fn value_2a(&self, i: c_int, default_value: *const u64) -> u64
This is an overloaded function.
Calls C++ function: GLuint64 QVector<GLuint64>::value(int i, const GLuint64& defaultValue) const
.
This is an overloaded function.
If the index i is out of bounds, the function returns defaultValue.
Trait Implementations§
source§impl Add<Ref<QVectorOfU64>> for &QVectorOfU64
impl Add<Ref<QVectorOfU64>> for &QVectorOfU64
source§fn add(self, l: Ref<QVectorOfU64>) -> CppBox<QVectorOfU64>
fn add(self, l: Ref<QVectorOfU64>) -> CppBox<QVectorOfU64>
Returns a vector that contains all the items in this vector followed by all the items in the other vector.
Calls C++ function: QVector<GLuint64> QVector<GLuint64>::operator+(const QVector<GLuint64>& l) const
.
Returns a vector that contains all the items in this vector followed by all the items in the other vector.
See also operator+=().
§type Output = CppBox<QVectorOfU64>
type Output = CppBox<QVectorOfU64>
+
operator.source§impl CppDeletable for QVectorOfU64
impl CppDeletable for QVectorOfU64
source§impl Data for QVectorOfU64
impl Data for QVectorOfU64
source§impl DataMut for QVectorOfU64
impl DataMut for QVectorOfU64
source§unsafe fn data_mut(&self) -> *mut u64
unsafe fn data_mut(&self) -> *mut u64
Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector.
Calls C++ function: GLuint64* QVector<GLuint64>::data()
.
Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector.
Example:
QVector<int> vector(10); int data = vector.data(); for (int i = 0; i < 10; ++i) data[i] = 2 i;
The pointer remains valid as long as the vector isn't reallocated.
This function is mostly useful to pass a vector to a function that accepts a plain C++ array.
See also constData() and operator[]().
source§impl Ge<Ref<QVectorOfU64>> for QVectorOfU64
impl Ge<Ref<QVectorOfU64>> for QVectorOfU64
source§unsafe fn ge(&self, rhs: &Ref<QVectorOfU64>) -> bool
unsafe fn ge(&self, rhs: &Ref<QVectorOfU64>) -> bool
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator>=(const QVector<GLuint64>& lhs, const QVector<GLuint64>& rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator>=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise returns false
.
source§impl Gt<Ref<QVectorOfU64>> for QVectorOfU64
impl Gt<Ref<QVectorOfU64>> for QVectorOfU64
source§impl Le<Ref<QVectorOfU64>> for QVectorOfU64
impl Le<Ref<QVectorOfU64>> for QVectorOfU64
source§unsafe fn le(&self, rhs: &Ref<QVectorOfU64>) -> bool
unsafe fn le(&self, rhs: &Ref<QVectorOfU64>) -> bool
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
Calls C++ function: bool operator<=(const QVector<GLuint64>& lhs, const QVector<GLuint64>& rhs)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator<=(QChar c1, QChar c2)
:
Returns true
if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise returns false
.
source§impl Lt<Ref<QVectorOfU64>> for QVectorOfU64
impl Lt<Ref<QVectorOfU64>> for QVectorOfU64
source§impl PartialEq<Ref<QVectorOfU64>> for QVectorOfU64
impl PartialEq<Ref<QVectorOfU64>> for QVectorOfU64
source§fn eq(&self, v: &Ref<QVectorOfU64>) -> bool
fn eq(&self, v: &Ref<QVectorOfU64>) -> bool
Returns true
if other is equal to this vector; otherwise returns false
.
Calls C++ function: bool QVector<GLuint64>::operator==(const QVector<GLuint64>& v) const
.
Returns true
if other is equal to this vector; otherwise returns false
.
Two vectors are considered equal if they contain the same values in the same order.
This function requires the value type to have an implementation of operator==()
.
See also operator!=().
source§impl Shl<*const u64> for &QVectorOfU64
impl Shl<*const u64> for &QVectorOfU64
source§fn shl(self, t: *const u64) -> Ref<QVectorOfU64>
fn shl(self, t: *const u64) -> Ref<QVectorOfU64>
Appends value to the vector and returns a reference to this vector.
Calls C++ function: QVector<GLuint64>& QVector<GLuint64>::operator<<(const GLuint64& t)
.
Appends value to the vector and returns a reference to this vector.
See also append() and operator+=().
§type Output = Ref<QVectorOfU64>
type Output = Ref<QVectorOfU64>
<<
operator.source§impl Shl<Ref<QVectorOfU64>> for &QVectorOfU64
impl Shl<Ref<QVectorOfU64>> for &QVectorOfU64
source§fn shl(self, l: Ref<QVectorOfU64>) -> Ref<QVectorOfU64>
fn shl(self, l: Ref<QVectorOfU64>) -> Ref<QVectorOfU64>
Appends other to the vector and returns a reference to the vector.
Calls C++ function: QVector<GLuint64>& QVector<GLuint64>::operator<<(const QVector<GLuint64>& l)
.
Appends other to the vector and returns a reference to the vector.
§type Output = Ref<QVectorOfU64>
type Output = Ref<QVectorOfU64>
<<
operator.