octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Potentially "dangerous" changeset, please test


From: Michael Goffioul
Subject: Re: Potentially "dangerous" changeset, please test
Date: Fri, 7 Oct 2011 09:59:33 +0100

2011/10/6 Jordi Gutiérrez Hermoso <address@hidden>:
> 2011/10/6 Michael Goffioul <address@hidden>:
>
>> As I suspected, the change above fails to compile under MSVC, because
>> the header to include is <unordered_map>, not <tr1/unordered_map>.
>> In C++11, the header to include is also <unordered_map>. So I suggest
>> you write a configure test to check for the header location and namespace
>> to use.
>
> If you know how to do this, could you please do it yourself? If not,
> please wait until I figure out how. :-)

For the namespace detection, you could try (disclaimer: completely untested):

unordered_map_requires_tr1_namespace=no
if test "$ac_cv_header_unordered_map" = "yes; then
  AC_COMPILE_IFELSE([
    AC_LANG_PROGRAM([
      #include <unordered_map>
    ], [
      std::unordered_map m;
    ]),
  [unordered_map_requires_tr1_namespace=yes])
fi
if test "$unordered_map_requires_tr1_namespace" = "yes"; then
  AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Defines whether
unordered_map requires the use of tr1 namespace.])
fi

Then in rand.cc, you could then use:

#if USE_UNORDERED_MAP_WITH_TR1
using namespace std::tr1;
#else
using namespace std;
#endif

And then you can simply use unordered_map in the rest of the code.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]