Use a better check for support for std::unordered_map.

This commit is contained in:
John Maguire 2012-11-22 12:24:38 +01:00
parent 0beab5c9a8
commit 8bbcd6b760
3 changed files with 16 additions and 9 deletions

View File

@ -16,6 +16,15 @@ if (CMAKE_CXX_COMPILER MATCHES ".*clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized")
endif ()
check_cxx_source_compiles(
"#include <unordered_map>
int main() {
std::unordered_map<int, int> m;
return 0;
}
"
USE_STD_UNORDERED_MAP)
if (UNIX AND NOT APPLE)
set(LINUX 1)
endif (UNIX AND NOT APPLE)

View File

@ -43,5 +43,6 @@
#cmakedefine IMOBILEDEVICE_USES_UDIDS
#cmakedefine USE_INSTALL_PREFIX
#cmakedefine USE_SYSTEM_PROJECTM
#cmakedefine USE_STD_UNORDERED_MAP
#endif // CONFIG_H_IN

View File

@ -64,15 +64,12 @@
#include <algorithm>
#include <boost/bind.hpp>
#ifdef Q_OS_DARWIN
#include <tr1/unordered_map>
// I'm sorry...
namespace std {
using tr1::unordered_map;
}
#else
#ifdef USE_STD_UNORDERED_MAP
#include <unordered_map>
using std::unordered_map;
#else
#include <tr1/unordered_map>
using std::tr1::unordered_map;
#endif
using smart_playlists::Generator;
@ -1944,7 +1941,7 @@ struct SongSimilarEqual {
void Playlist::RemoveDuplicateSongs() {
QList<int> rows_to_remove;
std::unordered_map<Song, int, SongSimilarHash, SongSimilarEqual> unique_songs;
unordered_map<Song, int, SongSimilarHash, SongSimilarEqual> unique_songs;
for (int row = 0; row < items_.count(); ++row) {
PlaylistItemPtr item = items_[row];