allow constructing DynamicVector for data
also add default constructor and accessor
This commit is contained in:
@@ -37,10 +37,16 @@ namespace Opm {
|
||||
template <class T>
|
||||
class DynamicVector {
|
||||
public:
|
||||
DynamicVector() = default;
|
||||
|
||||
DynamicVector(const TimeMap& timeMap, T defaultValue) :
|
||||
m_data( timeMap.size(), defaultValue )
|
||||
{}
|
||||
|
||||
explicit DynamicVector(const std::vector<T>& data) :
|
||||
m_data(data)
|
||||
{}
|
||||
|
||||
const T& operator[](size_t index) const {
|
||||
return this->m_data.at( index );
|
||||
}
|
||||
@@ -58,6 +64,10 @@ namespace Opm {
|
||||
(*this)[index] = std::move( value );
|
||||
}
|
||||
|
||||
const std::vector<T>& data() const {
|
||||
return m_data;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<T> m_data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user