[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] implement hash_map with std::tr1
From: |
Zack Weinberg |
Subject: |
Re: [Monotone-devel] implement hash_map with std::tr1 |
Date: |
Sun, 16 Jul 2006 11:04:22 -0700 |
On 7/16/06, Benoît Dejean <address@hidden> wrote:
Le dimanche 30 avril 2006 à 19:13 +0200, Benoît Dejean a écrit :
> Le dimanche 30 avril 2006 à 05:55 -0700, Nathaniel Smith a écrit :
> > On Sun, Apr 30, 2006 at 10:54:32AM +0200, Benoît Dejean wrote:
> > > +#if defined(__GNUC__) && (__GNUC__ >= 4)
> > > #define HASHMAP_PRESENT
> >
> > This is the wrong way to do feature availability checks... can we use
> > autoconf here instead? (Especially because many compilers besides
> > g++4 will have std::tr1 support, one hopes!)
>
> that's what i was thinking, but i don't know how.
Something like this:
AC_CACHE_CHECK([for tr1::unordered_map and tr1::unordered_set],
ac_cv_cxx_tr1_unordered_map_and_set,
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE(AC_LANG_SOURCE([
#include <tr1/functional>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
using std::tr1::hash;
using std::tr1::unordered_map;
using std::tr1::unordered_set;
using std::tr1::unordered_multimap;
]),
ac_cv_cxx_tr1_unordered_map_and_set=yes,
ac_cv_cxx_tr1_unordered_map_and_set=no)
AC_LANG_POP(C++)])
if test x$ac_cv_cxx_tr1_unordered_map_and_set = xyes; then
AC_DEFINE(HAVE_TR1_UNORDERED_MAP_AND_SET, 1,
[Define to 1 if your C++ compiler provides
tr1::unordered_map and tr1::unordered_set.])
fi
If you don't know what to do with this, you can check your changes in
on a branch as they are and announce that you've done so, and I'll add
the autoconf stuff on top.
Nathaniel, did you have any other issues with the original patch?
zw