Template Struct SharedVectorο
Defined in File slint_sharedvector.h
Struct Documentationο
-
template<typename T>
struct slint::SharedVectorο SharedVector is a vector template class similar to std::vector thatβs primarily used for passing data in and out of the Slint run-time library. It uses implicit-sharing to make creating copies cheap. Only when a function changes the vectorβs data, a copy is is made.
Public Functions
-
inline SharedVector()ο
Creates a new, empty vector.
-
inline SharedVector(std::initializer_list<T> args)ο
Creates a new vector that holds all the elements of the given std::initializer_list args.
-
inline SharedVector(const SharedVector &other)ο
Creates a new vector that is a copy of other.
-
inline ~SharedVector()ο
Destroys this vector. The underlying data is destroyed if no other vector references it.
-
inline SharedVector &operator=(const SharedVector &other)ο
Assigns the data of other to this vector and returns a reference to this vector.
-
inline SharedVector &operator=(SharedVector &&other)ο
Move-assignβs other to this vector and returns a reference to this vector.
-
inline const T *cend() constο
Returns a const pointer that points past the last element of this vector. The pointer cannot be dereferenced, it can only be used for comparison.
-
inline const T *end() constο
Returns a const pointer that points past the last element of this vector. The pointer cannot be dereferenced, it can only be used for comparison.
-
inline T *end()ο
Returns a pointer that points past the last element of this vector. The pointer cannot be dereferenced, it can only be used for comparison.
-
inline std::size_t size() constο
Returns the number of elements in this vector.
-
inline bool empty() constο
Returns true if there are no elements on this vector; false otherwise.
-
inline T &operator[](std::size_t index)ο
This indexing operator returns a reference to the th element of this vector.
-
inline const T &operator[](std::size_t index) constο
This indexing operator returns a const reference to the th element of this vector.
-
inline const T &at(std::size_t index) constο
Returns a reference to the th element of this vector.
-
inline void push_back(const T &value)ο
Appends the value as a new element to the end of this vector.
-
inline void clear()ο
Clears the vector and removes all elements. The capacity remains unaffected.
Friends
-
inline friend bool operator==(const SharedVector &a, const SharedVector &b)ο
Returns true if the vector a has the same number of elements as b and all the elements also compare equal; false otherwise.
-
inline friend bool operator!=(const SharedVector &a, const SharedVector &b)ο
Returns false if the vector a has the same number of elements as b and all the elements also compare equal; true otherwise.
-
inline SharedVector()ο