list.h revision eb4b342c83eb47585ce579d9aee898e7a33a96d5
236b2935f217749893b7034e59da3e3568928acevboxsync * IPRT - Generic List Class.
236b2935f217749893b7034e59da3e3568928acevboxsync * Copyright (C) 2011 Oracle Corporation
236b2935f217749893b7034e59da3e3568928acevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
236b2935f217749893b7034e59da3e3568928acevboxsync * available from http://www.virtualbox.org. This file is free software;
236b2935f217749893b7034e59da3e3568928acevboxsync * you can redistribute it and/or modify it under the terms of the GNU
236b2935f217749893b7034e59da3e3568928acevboxsync * General Public License (GPL) as published by the Free Software
236b2935f217749893b7034e59da3e3568928acevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
236b2935f217749893b7034e59da3e3568928acevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
236b2935f217749893b7034e59da3e3568928acevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
236b2935f217749893b7034e59da3e3568928acevboxsync * The contents of this file may alternatively be used under the terms
236b2935f217749893b7034e59da3e3568928acevboxsync * of the Common Development and Distribution License Version 1.0
236b2935f217749893b7034e59da3e3568928acevboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
236b2935f217749893b7034e59da3e3568928acevboxsync * VirtualBox OSE distribution, in which case the provisions of the
236b2935f217749893b7034e59da3e3568928acevboxsync * CDDL are applicable instead of those of the GPL.
236b2935f217749893b7034e59da3e3568928acevboxsync * You may elect to license modified versions of this file under the
236b2935f217749893b7034e59da3e3568928acevboxsync * terms and conditions of either the GPL or the CDDL or both.
157093a77f2752732368338110cb50fa6cd7717fvboxsync/** @defgroup grp_rt_cpp_list C++ List support
236b2935f217749893b7034e59da3e3568928acevboxsync * @ingroup grp_rt_cpp
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @brief Generic C++ list class support.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * This list classes manage any amount of data in a fast and easy to use way.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * They have no dependencies on STL, only on generic memory management methods
157093a77f2752732368338110cb50fa6cd7717fvboxsync * of IRPT. This allows list handling in situations where the use of STL
236b2935f217749893b7034e59da3e3568928acevboxsync * container classes is forbidden.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Not all of the functionality of STL container classes is implemented. There
236b2935f217749893b7034e59da3e3568928acevboxsync * are no iterators or any other high level access/modifier methods (e.g.
236b2935f217749893b7034e59da3e3568928acevboxsync * std::algorithms).
236b2935f217749893b7034e59da3e3568928acevboxsync * The implementation is array based which allows fast access to the items.
236b2935f217749893b7034e59da3e3568928acevboxsync * Appending items is usually also fast, cause the internal array is
236b2935f217749893b7034e59da3e3568928acevboxsync * preallocated. To minimize the memory overhead, native types (that is
236b2935f217749893b7034e59da3e3568928acevboxsync * everything smaller then the size of void*) are directly saved in the array.
236b2935f217749893b7034e59da3e3568928acevboxsync * If bigger types are used (e.g. RTCString) the internal array is an array of
236b2935f217749893b7034e59da3e3568928acevboxsync * pointers to the objects.
236b2935f217749893b7034e59da3e3568928acevboxsync * The size of the internal array will usually not shrink, but grow
157093a77f2752732368338110cb50fa6cd7717fvboxsync * automatically. Only certain methods, like RTCList::clear or the "=" operator
236b2935f217749893b7034e59da3e3568928acevboxsync * will reset any previously allocated memory. You can call
236b2935f217749893b7034e59da3e3568928acevboxsync * RTCList::setCapacity for manual adjustment. If the size of an new list will
236b2935f217749893b7034e59da3e3568928acevboxsync * be known, calling the constructor with the necessary capacity will speed up
236b2935f217749893b7034e59da3e3568928acevboxsync * the insertion of the new items.
3357df142080b5abd7a5da3358371ce0bff34e91vboxsync * For the full public interface these list classes offer see RTCListBase.
236b2935f217749893b7034e59da3e3568928acevboxsync * There are some requirements for the types used which follow:
236b2935f217749893b7034e59da3e3568928acevboxsync * -# They need a default and a copy constructor.
236b2935f217749893b7034e59da3e3568928acevboxsync * -# Some methods (e.g. RTCList::contains) need an equal operator.
236b2935f217749893b7034e59da3e3568928acevboxsync * -# If the type is some complex class (that is, having a constructor which
236b2935f217749893b7034e59da3e3568928acevboxsync * allocates members on the heap) it has to be greater than sizeof(void*) to
236b2935f217749893b7034e59da3e3568928acevboxsync * be used correctly. If this is not the case you can manually overwrite the
236b2935f217749893b7034e59da3e3568928acevboxsync * list behavior. Just add T* as a second parameter to the list template if
236b2935f217749893b7034e59da3e3568928acevboxsync * your class is called T. Another possibility is to specialize the list for
236b2935f217749893b7034e59da3e3568928acevboxsync * your target class. See below for more information.
236b2935f217749893b7034e59da3e3568928acevboxsync * The native types like int, bool, ptr, ..., are meeting this criteria, so
236b2935f217749893b7034e59da3e3568928acevboxsync * they are save to use.
236b2935f217749893b7034e59da3e3568928acevboxsync * Please note that the return type of some of the getter methods are slightly
236b2935f217749893b7034e59da3e3568928acevboxsync * different depending on the list type. Native types return the item by value,
236b2935f217749893b7034e59da3e3568928acevboxsync * items with a size greater than sizeof(void*) by reference. As native types
236b2935f217749893b7034e59da3e3568928acevboxsync * saved directly in the internal array, returning a reference to them (and
236b2935f217749893b7034e59da3e3568928acevboxsync * saving them in a reference as well) would make them invalid (or pointing to
236b2935f217749893b7034e59da3e3568928acevboxsync * a wrong item) when the list is changed in the meanwhile. Returning a
236b2935f217749893b7034e59da3e3568928acevboxsync * reference for bigger types isn't problematic and makes sure we get out the
236b2935f217749893b7034e59da3e3568928acevboxsync * best speed of the list. The one exception to this rule is the index
236b2935f217749893b7034e59da3e3568928acevboxsync * operator[]. This operator always return a reference to make it possible to
236b2935f217749893b7034e59da3e3568928acevboxsync * use it as a lvalue. Its your responsibility to make sure the list isn't
236b2935f217749893b7034e59da3e3568928acevboxsync * changed when using the value as reference returned by this operator.
236b2935f217749893b7034e59da3e3568928acevboxsync * The list class is reentrant. For a thread-safe variant see RTCMTList.
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync * Implementation details:
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync * It is possible to specialize any type. This might be necessary to get the
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync * best speed out of the list. Examples are the 64-bit types, which use the
236b2935f217749893b7034e59da3e3568928acevboxsync * native (no pointers) implementation even on a 32-bit host. Consult the
236b2935f217749893b7034e59da3e3568928acevboxsync * source code for more details.
236b2935f217749893b7034e59da3e3568928acevboxsync * Current specialized implementations:
236b2935f217749893b7034e59da3e3568928acevboxsync * - int64_t: RTCList<int64_t>
236b2935f217749893b7034e59da3e3568928acevboxsync * - uint64_t: RTCList<uint64_t>
4ab1e1de561327173718600b82c542cbe1cc878cvboxsync * The guard definition.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * The default guard which does nothing.
236b2935f217749893b7034e59da3e3568928acevboxsync inline void enterRead() const {}
bc5cd42756b3f98351040bbfccc08dd9bacd103avboxsync inline void leaveRead() const {}
4ab1e1de561327173718600b82c542cbe1cc878cvboxsync inline void enterWrite() {}
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync inline void leaveWrite() {}
236b2935f217749893b7034e59da3e3568928acevboxsync /* Define our own new and delete. */
3357df142080b5abd7a5da3358371ce0bff34e91vboxsync * General helper template for managing native values in RTCListBase.
236b2935f217749893b7034e59da3e3568928acevboxsync static inline void set(T2 *p, size_t i, const T1 &v) { p[i] = v; }
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync static inline T1 & at(T2 *p, size_t i) { return p[i]; }
236b2935f217749893b7034e59da3e3568928acevboxsync static inline size_t find(T2 *p, const T1 &v, size_t cSize)
236b2935f217749893b7034e59da3e3568928acevboxsync if (p[i] == v)
bb50cfa1b9de06edfb8d96f8d47dbd5394fb4ce3vboxsync static inline void copyTo(T2 *p, T2 *const p1 , size_t iTo, size_t cSize)
bb50cfa1b9de06edfb8d96f8d47dbd5394fb4ce3vboxsync static inline void erase(T2 *p, size_t /* i */) { /* Nothing to do here. */ }
bb50cfa1b9de06edfb8d96f8d47dbd5394fb4ce3vboxsync static inline void eraseRange(T2 * /* p */, size_t /* cFrom */, size_t /* cSize */) { /* Nothing to do here. */ }
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Specialized helper template for managing pointer values in RTCListBase.
bb50cfa1b9de06edfb8d96f8d47dbd5394fb4ce3vboxsync static inline void set(T1 **p, size_t i, const T1 &v) { p[i] = new T1(v); }
bb50cfa1b9de06edfb8d96f8d47dbd5394fb4ce3vboxsync static inline T1 & at(T1 **p, size_t i) { return *p[i]; }
157093a77f2752732368338110cb50fa6cd7717fvboxsync static inline size_t find(T1 **p, const T1 &v, size_t cSize)
157093a77f2752732368338110cb50fa6cd7717fvboxsync if (*p[i] == v)
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync static inline void copyTo(T1 **p, T1 **const p1 , size_t iTo, size_t cSize)
236b2935f217749893b7034e59da3e3568928acevboxsync static inline void erase(T1 **p, size_t i) { delete p[i]; }
236b2935f217749893b7034e59da3e3568928acevboxsync static inline void eraseRange(T1 **p, size_t cFrom, size_t cSize)
236b2935f217749893b7034e59da3e3568928acevboxsync * This is the base class for all other list classes. It implements the
236b2935f217749893b7034e59da3e3568928acevboxsync * necessary list functionality in a type independent way and offers the public
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * list interface to the user.
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Defines the return type of most of the getter methods. If the internal
236b2935f217749893b7034e59da3e3568928acevboxsync * used type is a pointer, we return a reference. If not we return by
236b2935f217749893b7034e59da3e3568928acevboxsync typedef typename RTCIfPtr<ITYPE, T&, T>::result GET_RTYPE;
236b2935f217749893b7034e59da3e3568928acevboxsync typedef typename RTCIfPtr<ITYPE, const T&, T>::result GET_CRTYPE;
5067a9619d7131c54d4ebb371d9dac91abdd34f6vboxsync * Creates a new list.
236b2935f217749893b7034e59da3e3568928acevboxsync * This preallocates @a cCapacity elements within the list.
236b2935f217749893b7034e59da3e3568928acevboxsync * @param cCapacitiy The initial capacity the list has.
236b2935f217749893b7034e59da3e3568928acevboxsync * @throws std::bad_alloc
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Creates a copy of another list.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * The other list will be fully copied and the capacity will be the same as
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * the size of the other list.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @param other The list to copy.
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync * @throws std::bad_alloc
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync RTCListBase(const RTCListBase<T, ITYPE, MT>& other)
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync RTCListHelper<T, ITYPE>::copyTo(m_pArray, other.m_pArray, 0, other.m_cSize);
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Destructor.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cSize);
4ae0ac3d0dc641305a0b0197db43ee7c4b40f747vboxsync * Sets a new capacity within the list.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * If the new capacity is bigger than the old size, it will be simply
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * preallocated more space for the new items. If the new capacity is
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * smaller than the previous size, items at the end of the list will be
236b2935f217749893b7034e59da3e3568928acevboxsync * @param cCapacity The new capacity within the list.
236b2935f217749893b7034e59da3e3568928acevboxsync * @throws std::bad_alloc
236b2935f217749893b7034e59da3e3568928acevboxsync * Return the current capacity of the list.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @return The actual capacity.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Check if an list contains any items.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @return True if there is more than zero items, false otherwise.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Return the current count of elements within the list.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @return The current element count.
4ae0ac3d0dc641305a0b0197db43ee7c4b40f747vboxsync * Inserts an item to the list at position @a i.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @param i The position of the new item.
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync * @param val The new item.
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync * @return a reference to this list.
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync * @throws std::bad_alloc
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync RTCListBase<T, ITYPE, MT> &insert(size_t i, const T &val)
26f7a9a33aba00f6fe644eece95158d147ae3dbdvboxsync memmove(&m_pArray[i + 1], &m_pArray[i], (m_cSize - i) * sizeof(ITYPE));
4ae0ac3d0dc641305a0b0197db43ee7c4b40f747vboxsync * Prepend an item to the list.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @param val The new item.
4ae0ac3d0dc641305a0b0197db43ee7c4b40f747vboxsync * @return a reference to this list.
4ae0ac3d0dc641305a0b0197db43ee7c4b40f747vboxsync * @throws std::bad_alloc
236b2935f217749893b7034e59da3e3568928acevboxsync * Prepend a list of type T to the list.
236b2935f217749893b7034e59da3e3568928acevboxsync * @param other The list to prepend.
236b2935f217749893b7034e59da3e3568928acevboxsync * @return a reference to this list.
236b2935f217749893b7034e59da3e3568928acevboxsync * @throws std::bad_alloc
236b2935f217749893b7034e59da3e3568928acevboxsync RTCListBase<T, ITYPE, MT> &prepend(const RTCListBase<T, ITYPE, MT> &other)
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync realloc_grow(m_cCapacity + (other.m_cSize - (m_cCapacity - m_cSize)));
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync memmove(&m_pArray[other.m_cSize], &m_pArray[0], m_cSize * sizeof(ITYPE));
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync RTCListHelper<T, ITYPE>::copyTo(m_pArray, other.m_pArray, 0, other.m_cSize);
236b2935f217749893b7034e59da3e3568928acevboxsync * Append an item to the list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param val The new item.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return a reference to this list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @throws std::bad_alloc
157093a77f2752732368338110cb50fa6cd7717fvboxsync RTCListHelper<T, ITYPE>::set(m_pArray, m_cSize, val);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Append a list of type T to the list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param other The list to append.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return a reference to this list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @throws std::bad_alloc
157093a77f2752732368338110cb50fa6cd7717fvboxsync RTCListBase<T, ITYPE, MT> &append(const RTCListBase<T, ITYPE, MT> &other)
157093a77f2752732368338110cb50fa6cd7717fvboxsync realloc_grow(m_cCapacity + (other.m_cSize - (m_cCapacity - m_cSize)));
157093a77f2752732368338110cb50fa6cd7717fvboxsync RTCListHelper<T, ITYPE>::copyTo(m_pArray, other.m_pArray, m_cSize, other.m_cSize);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Copy the items of the other list into this list. All previous items of
157093a77f2752732368338110cb50fa6cd7717fvboxsync * this list are deleted.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param other The list to copy.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return a reference to this list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync RTCListBase<T, ITYPE, MT> &operator=(const RTCListBase<T, ITYPE, MT>& other)
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* Prevent self assignment */
157093a77f2752732368338110cb50fa6cd7717fvboxsync /* Values cleanup */
157093a77f2752732368338110cb50fa6cd7717fvboxsync RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cSize);
157093a77f2752732368338110cb50fa6cd7717fvboxsync RTCListHelper<T, ITYPE>::copyTo(m_pArray, other.m_pArray, 0, other.m_cSize);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Replace an item in the list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
157093a77f2752732368338110cb50fa6cd7717fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param i The position of the item to replace.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param val The new value.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return a reference to this list.
157093a77f2752732368338110cb50fa6cd7717fvboxsync RTCListBase<T, ITYPE, MT> &replace(size_t i, const T &val)
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Return the first item as constant object.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return The first item.
157093a77f2752732368338110cb50fa6cd7717fvboxsync GET_CRTYPE res = RTCListHelper<T, ITYPE>::at(m_pArray, 0);
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Return the first item.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return The first item.
157093a77f2752732368338110cb50fa6cd7717fvboxsync GET_RTYPE res = RTCListHelper<T, ITYPE>::at(m_pArray, 0);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Return the last item as constant object.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
157093a77f2752732368338110cb50fa6cd7717fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return The last item.
157093a77f2752732368338110cb50fa6cd7717fvboxsync GET_CRTYPE res = RTCListHelper<T, ITYPE>::at(m_pArray, m_cSize - 1);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Return the last item.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
157093a77f2752732368338110cb50fa6cd7717fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return The last item.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync GET_RTYPE res = RTCListHelper<T, ITYPE>::at(m_pArray, m_cSize - 1);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Return the item at position @a i as constant object.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param i The position of the item to return.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return The item at position @a i.
157093a77f2752732368338110cb50fa6cd7717fvboxsync GET_CRTYPE res = RTCListHelper<T, ITYPE>::at(m_pArray, i);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Return the item at position @a i.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
157093a77f2752732368338110cb50fa6cd7717fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param i The position of the item to return.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return The item at position @a i.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync GET_RTYPE res = RTCListHelper<T, ITYPE>::at(m_pArray, i);
157093a77f2752732368338110cb50fa6cd7717fvboxsync * Return the item at position @a i as mutable reference.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @note No boundary checks are done. Make sure @a i is equal or greater zero
157093a77f2752732368338110cb50fa6cd7717fvboxsync * and smaller than RTCList::size.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @param i The position of the item to return.
157093a77f2752732368338110cb50fa6cd7717fvboxsync * @return The item at position @a i.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Return the item at position @a i. If @a i isn't valid within the list a
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * default value is returned.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @param i The position of the item to return.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @return The item at position @a i.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync return T();
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * Return the item at position @a i. If @a i isn't valid within the list
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @a defaultVal is returned.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @param i The position of the item to return.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @param defaultVal The value to return in case @a i is invalid.
2ac3892cdc8b16a0dee55e8b4510b8ecea83c95fvboxsync * @return The item at position @a i.
if (i >= m_cSize)
return defaultVal;
return res;
return res;
void removeFirst()
removeAt(0);
void removeLast()
--m_cSize;
void clear()
m_cSize = 0;
return res;
&& m_pArray)
if ( cNewSize == 0
&& m_pArray)
m_pArray = 0;
if (cNewSize > 0)
if (!m_pArray)
m_cCapacity = 0;
m_cSize = 0;
#ifdef RT_EXCEPTIONS_ENABLED
if (!m_pArray)
m_cCapacity = 0;
m_cSize = 0;
#ifdef RT_EXCEPTIONS_ENABLED
template <>
template <>