mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
Added new method index()
This commit is contained in:
parent
6941db21af
commit
319d9a1aa7
@ -76,6 +76,7 @@ public:
|
||||
size_t count(const DataType* pointer) const;
|
||||
|
||||
void erase(size_t index);
|
||||
size_t index(DataType* pointer);
|
||||
|
||||
// Child objects
|
||||
|
||||
|
@ -141,6 +141,18 @@ void PdmChildArrayField<DataType*>::erase(size_t index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get the index of the given object pointer
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename DataType>
|
||||
size_t PdmChildArrayField<DataType*>::index(DataType* pointer)
|
||||
{
|
||||
typename std::vector< PdmPointer<DataType> >::iterator it = std::find(m_pointers.begin(), m_pointers.end(), pointer);
|
||||
return it - m_pointers.begin();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Removes all instances of object pointer from the container without deleting the object.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user