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: Jordi Gutiérrez Hermoso
Subject: Re: Potentially "dangerous" changeset, please test
Date: Thu, 20 Oct 2011 14:29:51 -0500

2011/10/20 Michael Goffioul <address@hidden>:
> 2011/10/7 Michael Goffioul <address@hidden>:
>> 2011/10/7 Michael Goffioul <address@hidden>:
>>> 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.
>>
>> Note that you may also need to surround these snippets with
>> AC_LANG_PUSH(C++) and AC_LANG_POP(C++). As well as with
>> AC_MSG_CHECKING([whether unordered_map requires tr1 namespace])
>> and AC_MSG_RESULT([$unordered_map_requires_tr1_namespace])
>
> Change http://hg.savannah.gnu.org/hgweb/octave/rev/478efc95cb7a should
> fix the issue.

Thank you very much. I made a slight modification because I don't like
bringing all of a namespace into scope. It was very instructive to
read how you patched configure.ac.

- Jordi G. H.


reply via email to

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