[Trilinos-Users] [EXTERNAL] Sacado compilation error

Phipps, Eric T etphipp at sandia.gov
Tue Oct 7 08:25:56 MDT 2014


Generally yes, however in this case I think it is a reasonable thing to do
in that we are just providing overloads for things that are already in the
std namespace.  The issue is that people using sacado tend to want to
write template code such as this:

template <typename T>
T func(const T& x) {
  return std::sin(x);
}

and then to be able to call func on builtin types and sacado types.
Without these overloads, that fails for any sacado type.  The alternative
would be to write code like this:

template <typename T>
T func(const T& x) {
  using std::sin;
  return sin(x);
}

Generally the feedback that I have received from sacado users is they
prefer the first approach, so I am trying to preserve that.

-Eric

On 10/7/14, 3:08 AM, "Marco Morandini" <marco.morandini at polimi.it> wrote:

>On 10/06/2014 06:44 PM, Phipps, Eric T wrote:
>> Hi Simone,
>>
>> This is a problem that I¹ve known about ever since Apple replaced their
>> system compiler with clang, and stems from Sacado¹s injections of its
>> overloads into the std namespace (so you can do things like std::sin(x)
>> where x is a Sacado type and have it do the right thing).
>
>Isn't this dangerous in view of
>
>C++ 2003, Section 17.4.3.1 "Reserved names"
>
>https://www.securecoding.cert.org/confluence/display/cplusplus/MSC34-CPP.+
>Do+not+modify+the+standard+namespace
>
>?
>
>Marco
>



More information about the Trilinos-Users mailing list