From ba586bf2625b5b6dc9f9825a01d8676508f6872d Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 22 Mar 2020 17:32:31 +0100 Subject: [PATCH] Support for getting C array data from List. --- src/Collections/List.hpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Collections/List.hpp b/src/Collections/List.hpp index d28c411..2daad44 100644 --- a/src/Collections/List.hpp +++ b/src/Collections/List.hpp @@ -1,9 +1,9 @@ #ifndef ARBUTILS_LIST_HPP #define ARBUTILS_LIST_HPP +#include #include #include #include -#include namespace Arbutils::Collections { template class List { @@ -16,9 +16,7 @@ namespace Arbutils::Collections { explicit List(size_t capacity) : _vector(capacity) {} List(const std::initializer_list& l) : _vector(l) {} - inline void Clear(){ - _vector.clear(); - } + inline void Clear() { _vector.clear(); } inline const ValueT& At(size_t index) const { #ifndef NO_ASSERT @@ -41,9 +39,7 @@ namespace Arbutils::Collections { return _vector.at(index); } - inline bool Contains(ValueT value){ - return std::find(_vector.begin(), _vector.end(), value) != _vector.end(); - } + inline bool Contains(ValueT value) { return std::find(_vector.begin(), _vector.end(), value) != _vector.end(); } inline void Append(ValueT value) { _vector.push_back(value); } @@ -54,12 +50,13 @@ namespace Arbutils::Collections { inline size_t Count() { return _vector.size(); } - iterator begin() { return _vector.begin(); } iterator begin() const { return _vector.begin(); } iterator end() { return _vector.end(); } iterator end() const { return _vector.end(); } + + const ValueT* RawData() const { return _vector.data(); } }; }