Clang: Compile fix for older clang

This patch is needed due to some issues of an older STL
implementation. The patch can safely be reverted when
Xcode 8 is marked as outdated.

Change-Id: I0f66eb6f3a0ae71f0da3f5678d9b4d47cdf146bf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Christian Stenger
2018-08-16 11:15:07 +02:00
parent 0bc721fa04
commit 5ddc14257d
2 changed files with 17 additions and 11 deletions

View File

@@ -26,8 +26,8 @@
#include "generatedfiles.h"
namespace ClangBackEnd {
template<class Type>
void GeneratedFiles::updateInternal(Type &&fileContainers)
void GeneratedFiles::update(V2::FileContainers &&fileContainers)
{
V2::FileContainers unionFileContainers;
unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size());
@@ -46,14 +46,23 @@ void GeneratedFiles::updateInternal(Type &&fileContainers)
m_fileContainers = std::move(unionFileContainers);
}
void GeneratedFiles::update(V2::FileContainers &&fileContainers)
{
updateInternal(std::move(fileContainers));
}
void GeneratedFiles::update(const V2::FileContainers &fileContainers)
{
updateInternal(fileContainers);
V2::FileContainers unionFileContainers;
unionFileContainers.reserve(m_fileContainers.size() + fileContainers.size());
auto compare = [] (const V2::FileContainer &first, const V2::FileContainer &second) {
return first.filePath < second.filePath;
};
std::set_union(fileContainers.begin(),
fileContainers.end(),
std::make_move_iterator(m_fileContainers.begin()),
std::make_move_iterator(m_fileContainers.end()),
std::back_inserter(unionFileContainers),
compare);
m_fileContainers = std::move(unionFileContainers);
}
class Compare {

View File

@@ -37,9 +37,6 @@ public:
void remove(const FilePaths &filePaths);
const V2::FileContainers &fileContainers() const;
private:
template<class Type>
void updateInternal(Type &&fileContainers);
private:
V2::FileContainers m_fileContainers;