This commit is contained in:
Behdad Esfahbod 2019-04-22 15:25:11 -04:00
parent 24da1d0860
commit ae8da4b61b
1 changed files with 6 additions and 3 deletions

View File

@ -209,13 +209,16 @@ template <typename T>
struct hb_is_iterable struct hb_is_iterable
{ {
private: private:
template <typename U> template <typename U>
static auto test (int) -> decltype (hb_declval (U).iter (), hb_true_t ()); static auto impl (hb_priority<1>) -> decltype (hb_declval (U).iter (), hb_true_t ());
template <typename> template <typename>
static hb_false_t test (...); static hb_false_t impl (hb_priority<0>);
public: public:
enum { value = decltype (test<T> (0))::value };
enum { value = decltype (impl<T> (hb_prioritize))::value };
}; };
#define hb_is_iterable(Iterable) hb_is_iterable<Iterable>::value #define hb_is_iterable(Iterable) hb_is_iterable<Iterable>::value