BAN: Vector now has Back() and Front() helpers
This commit is contained in:
parent
b491007eac
commit
b42469efd7
|
@ -30,6 +30,11 @@ namespace BAN
|
|||
const T& operator[](size_type) const;
|
||||
T& operator[](size_type);
|
||||
|
||||
const T& Back() const;
|
||||
T& Back();
|
||||
const T& Front() const;
|
||||
T& Front();
|
||||
|
||||
ErrorOr<void> Resize(size_type);
|
||||
ErrorOr<void> Reserve(size_type);
|
||||
|
||||
|
@ -105,6 +110,33 @@ namespace BAN
|
|||
return m_data[index];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& Vector<T>::Back() const
|
||||
{
|
||||
assert(m_size > 0);
|
||||
return m_data[m_size - 1];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& Vector<T>::Back()
|
||||
{
|
||||
assert(m_size > 0);
|
||||
return m_data[m_size - 1];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& Vector<T>::Front() const
|
||||
{
|
||||
assert(m_size > 0);
|
||||
return m_data[0];
|
||||
}
|
||||
template<typename T>
|
||||
T& Vector<T>::Front()
|
||||
{
|
||||
assert(m_size > 0);
|
||||
return m_data[0];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ErrorOr<void> Vector<T>::Resize(size_type size)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue