This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] libstdc++/21244


Paolo Carlini wrote:

>I agree about your "hyper-panic mode" remark. Actually I was exactly
>considering in my mind the last situation. In our current
>cpp_type_traits we have this specific code, exploiting your nice traitor:
>
>  template<class _Sp, class _Tp>
>    struct __traitor
>    {
>      enum { __value = _Sp::__value || _Tp::__value };
>      typedef typename __truth_type<__value>::__type __type;
>    };
>
>  template<typename _Tp>
>    struct __is_arithmetic
>    : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
>    { };
>
>Is this 100% safe even if the user (contra any good C++ programming book
>advice) overloads operator|| like, in c++/19404, operator/?!?
>  
>
Sigh, the below doesn't compile with 4.0 and mainline:

#include <vector>

class Foo
{
};

template<class T> Foo operator||(const Foo& arg1, T arg2)
{
  return Foo();
}

void foo()
{
  std::vector<int> bar(1);
}

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]