logic: improved performance of code blocks indexed header detection
This commit is contained in:
@@ -73,6 +73,12 @@ namespace utility
|
||||
template<typename SourceType, typename TargetType>
|
||||
std::vector<TargetType> convert(const std::vector<SourceType>& sourceContainer);
|
||||
|
||||
template<typename SourceType, typename TargetType>
|
||||
std::set<TargetType> convert(const std::set<SourceType>& sourceContainer, std::function<TargetType(const SourceType&)> conversion);
|
||||
|
||||
template<typename SourceType, typename TargetType>
|
||||
std::set<TargetType> convert(const std::set<SourceType>& sourceContainer);
|
||||
|
||||
template<typename T>
|
||||
std::vector<std::string> toStrings(const std::vector<T>& d);
|
||||
template<>
|
||||
@@ -259,7 +265,8 @@ template<typename SourceType, typename TargetType>
|
||||
std::vector<TargetType> utility::convert(const std::vector<SourceType>& sourceContainer, std::function<TargetType(const SourceType&)> conversion)
|
||||
{
|
||||
std::vector<TargetType> targetContainer;
|
||||
for (const SourceType& sourceElement: sourceContainer)
|
||||
targetContainer.reserve(sourceContainer.size());
|
||||
for (const SourceType& sourceElement : sourceContainer)
|
||||
{
|
||||
targetContainer.push_back(conversion(sourceElement));
|
||||
}
|
||||
@@ -270,6 +277,7 @@ template<typename SourceType, typename TargetType>
|
||||
std::vector<TargetType> utility::convert(const std::vector<SourceType>& sourceContainer)
|
||||
{
|
||||
std::vector<TargetType> targetContainer;
|
||||
targetContainer.reserve(sourceContainer.size());
|
||||
for (const SourceType& sourceElement : sourceContainer)
|
||||
{
|
||||
targetContainer.push_back(TargetType(sourceElement));
|
||||
@@ -277,6 +285,28 @@ std::vector<TargetType> utility::convert(const std::vector<SourceType>& sourceCo
|
||||
return targetContainer;
|
||||
}
|
||||
|
||||
template<typename SourceType, typename TargetType>
|
||||
std::set<TargetType> utility::convert(const std::set<SourceType>& sourceContainer, std::function<TargetType(const SourceType&)> conversion)
|
||||
{
|
||||
std::set<TargetType> targetContainer;
|
||||
for (const SourceType& sourceElement : sourceContainer)
|
||||
{
|
||||
targetContainer.insert(conversion(sourceElement));
|
||||
}
|
||||
return targetContainer;
|
||||
}
|
||||
|
||||
template<typename SourceType, typename TargetType>
|
||||
std::set<TargetType> utility::convert(const std::set<SourceType>& sourceContainer)
|
||||
{
|
||||
std::set<TargetType> targetContainer;
|
||||
for (const SourceType& sourceElement : sourceContainer)
|
||||
{
|
||||
targetContainer.insert(TargetType(sourceElement));
|
||||
}
|
||||
return targetContainer;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::vector<std::string> utility::toStrings(const std::vector<T>& d)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user