mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Added count
p4#: 21239
This commit is contained in:
parent
db1dd5dd0d
commit
9ae4ac94b6
@ -213,6 +213,7 @@ public:
|
||||
void set(size_t index, DataType* pointer);
|
||||
void insert(size_t indexAfter, DataType* pointer);
|
||||
void insert(size_t indexAfter, const std::vector<PdmPointer<DataType> >& objects);
|
||||
size_t count(const DataType* pointer) const;
|
||||
|
||||
void clear();
|
||||
void erase(size_t index);
|
||||
|
@ -482,6 +482,26 @@ void PdmPointersField<DataType*>::insert(size_t indexAfter, const std::vector<Pd
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template<typename DataType>
|
||||
size_t PdmPointersField<DataType*>::count(const DataType* pointer) const
|
||||
{
|
||||
size_t itemCount = 0;
|
||||
|
||||
typename std::vector< PdmPointer< DataType > >::const_iterator it;
|
||||
for (it = m_pointers.begin(); it != m_pointers.end(); ++it)
|
||||
{
|
||||
if (*it == pointer)
|
||||
{
|
||||
itemCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user