Support for getting C array data from List.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
7c98d3d4eb
commit
ba586bf262
|
@ -1,9 +1,9 @@
|
||||||
#ifndef ARBUTILS_LIST_HPP
|
#ifndef ARBUTILS_LIST_HPP
|
||||||
#define ARBUTILS_LIST_HPP
|
#define ARBUTILS_LIST_HPP
|
||||||
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
namespace Arbutils::Collections {
|
namespace Arbutils::Collections {
|
||||||
template <class ValueT> class List {
|
template <class ValueT> class List {
|
||||||
|
@ -16,9 +16,7 @@ namespace Arbutils::Collections {
|
||||||
explicit List(size_t capacity) : _vector(capacity) {}
|
explicit List(size_t capacity) : _vector(capacity) {}
|
||||||
List(const std::initializer_list<ValueT>& l) : _vector(l) {}
|
List(const std::initializer_list<ValueT>& l) : _vector(l) {}
|
||||||
|
|
||||||
inline void Clear(){
|
inline void Clear() { _vector.clear(); }
|
||||||
_vector.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const ValueT& At(size_t index) const {
|
inline const ValueT& At(size_t index) const {
|
||||||
#ifndef NO_ASSERT
|
#ifndef NO_ASSERT
|
||||||
|
@ -41,9 +39,7 @@ namespace Arbutils::Collections {
|
||||||
return _vector.at(index);
|
return _vector.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Contains(ValueT value){
|
inline bool Contains(ValueT value) { return std::find(_vector.begin(), _vector.end(), value) != _vector.end(); }
|
||||||
return std::find(_vector.begin(), _vector.end(), value) != _vector.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void Append(ValueT value) { _vector.push_back(value); }
|
inline void Append(ValueT value) { _vector.push_back(value); }
|
||||||
|
|
||||||
|
@ -54,12 +50,13 @@ namespace Arbutils::Collections {
|
||||||
|
|
||||||
inline size_t Count() { return _vector.size(); }
|
inline size_t Count() { return _vector.size(); }
|
||||||
|
|
||||||
|
|
||||||
iterator begin() { return _vector.begin(); }
|
iterator begin() { return _vector.begin(); }
|
||||||
iterator begin() const { return _vector.begin(); }
|
iterator begin() const { return _vector.begin(); }
|
||||||
|
|
||||||
iterator end() { return _vector.end(); }
|
iterator end() { return _vector.end(); }
|
||||||
iterator end() const { return _vector.end(); }
|
iterator end() const { return _vector.end(); }
|
||||||
|
|
||||||
|
const ValueT* RawData() const { return _vector.data(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue