Support for getting C array data from List.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-03-22 17:32:31 +01:00
parent 7c98d3d4eb
commit ba586bf262
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 5 additions and 8 deletions

View File

@ -1,9 +1,9 @@
#ifndef ARBUTILS_LIST_HPP
#define ARBUTILS_LIST_HPP
#include <algorithm>
#include <sstream>
#include <stdexcept>
#include <vector>
#include <algorithm>
namespace Arbutils::Collections {
template <class ValueT> class List {
@ -16,9 +16,7 @@ namespace Arbutils::Collections {
explicit List(size_t capacity) : _vector(capacity) {}
List(const std::initializer_list<ValueT>& 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(); }
};
}