Ignore:
Timestamp:
11/06/13 10:52:13 (5 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fix unordered_map include when using libc++ (clang).

Also omit the tr1 namespace if the compiler supports the c++11 standard.

(fixes #1341)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/hclust.cpp

    r11703 r11751  
    1 #define USE_TR1 1 
    2  
    3 #if USE_TR1 
    4     #if _MSC_VER 
    5         #define HAVE_TR1_DIR 0 
    6     #else 
    7         #define HAVE_TR1_DIR 1 
    8     #endif 
    9     // Diffrent includes required 
    10     #if HAVE_TR1_DIR 
    11         #include <tr1/unordered_map> 
    12     #else 
    13         #include <unordered_map> 
    14     #endif 
     1 
     2#include <ciso646> 
     3#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L 
     4    // C++11 support or using libc++ 
     5    #define HAVE_STD_UNORDERED_MAP 
     6#elif _MSC_VER 
     7    // At least on supported versions of MSVC (>= 2008)  we have 
     8    // std::unordered_map 
     9    #define HAVE_STD_UNORDERED_MAP 
     10#endif 
     11 
     12#ifdef HAVE_STD_UNORDERED_MAP 
     13    #include <unordered_map> 
     14    #define _HCLUST_UNORDERED_MAP std::unordered_map 
     15#else 
     16    // include and use from tr1 namespace 
     17    #include <tr1/unordered_map> 
     18    #define _HCLUST_UNORDERED_MAP std::tr1::unordered_map 
    1519#endif 
    1620 
     
    656660 
    657661 
    658 #if USE_TR1 
    659     typedef std::tr1::unordered_map<m_element, double, m_element_hash> join_scores; 
    660     typedef std::tr1::unordered_map<m_element, ordering_element, m_element_hash> cluster_ordering; 
    661 #else 
    662     typedef std::map<m_element, double> join_scores; 
    663     typedef std::map<m_element, ordering_element> cluster_ordering; 
    664 #endif 
     662 
     663typedef _HCLUST_UNORDERED_MAP<m_element, double, m_element_hash> join_scores; 
     664typedef _HCLUST_UNORDERED_MAP<m_element, ordering_element, m_element_hash> cluster_ordering; 
     665 
    665666 
    666667// Return the minimum distance between elements in matrix 
Note: See TracChangeset for help on using the changeset viewer.