Kaydet (Commit) 320a77a3 authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Noel Grandin

sc: Use std::find() to simplify code

Change-Id: I903a59591cd204556e873429280aac9cf8d5325a
Reviewed-on: https://gerrit.libreoffice.org/65067
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e98bcfcc
......@@ -44,6 +44,7 @@
#include <svl/sharedstring.hxx>
#include <unotools/collatorwrapper.hxx>
#include <algorithm>
#include <vector>
using ::rtl::math::approxEqual;
......@@ -732,12 +733,7 @@ bool ScDBQueryDataIterator::DataAccessMatrix::isValidQuery(SCROW nRow, const ScM
}
// Row is valid as long as there is at least one result being true.
vector<bool>::const_iterator itr = aResults.begin(), itrEnd = aResults.end();
for (; itr != itrEnd; ++itr)
if (*itr)
return true;
return false;
return std::find(aResults.begin(), aResults.end(), true) != aResults.end();
}
ScDBQueryDataIterator::Value::Value() :
......
......@@ -57,13 +57,12 @@ void ScDPSaveGroupItem::AddElementsFromGroup( const ScDPSaveGroupItem& rGroup )
bool ScDPSaveGroupItem::RemoveElement( const OUString& rName )
{
for (std::vector<OUString>::iterator aIter = aElements.begin(); aIter != aElements.end(); ++aIter)
if (*aIter == rName) //TODO: ignore case
{
aElements.erase(aIter); // found -> remove
return true; // don't have to look further
}
auto it = std::find(aElements.begin(), aElements.end(), rName); //TODO: ignore case
if (it != aElements.end())
{
aElements.erase(it);
return true;
}
return false; // not found
}
......
......@@ -25,6 +25,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/diagnose.h>
#include <algorithm>
using ::std::vector;
using ::com::sun::star::uno::Sequence;
......@@ -51,14 +52,7 @@ ScDPFilteredCache::GroupFilter::GroupFilter()
bool ScDPFilteredCache::GroupFilter::match(const ScDPItemData& rCellData) const
{
vector<ScDPItemData>::const_iterator it = maItems.begin(), itEnd = maItems.end();
for (; it != itEnd; ++it)
{
bool bMatch = *it == rCellData;
if (bMatch)
return true;
}
return false;
return std::find(maItems.begin(), maItems.end(), rCellData) != maItems.end();
}
std::vector<ScDPItemData> ScDPFilteredCache::GroupFilter::getMatchValues() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment