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: [v3] traits duplicate removal


Benjamin Kosnik wrote:

This merges various duplicate traits code scattered around the library
into ext/type_traits.h. In doing so, all duplicate effort has been
eliminated, and essential traits missing from std::tr1's <type_traits>
have been found.

If we find new and useful traits, they should go in <ext/type_traits.h>.

If people want to use type_traits in their own code, I suggest using

<tr1/type_traits>


Benjamin, we have a problem with -pedantic:

#include <tr1/random>

int main()
{
 std::tr1::mt19937 mt;
}

paolo:~/Work/tr1_random/scratch> g++ -pedantic mt.cc
In file included from /home/paolo/Gcc/svn-dirs/trunk-install/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/tr1/random:2569,
from mt.cc:1:
/home/paolo/Gcc/svn-dirs/trunk-install/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/ext/type_traits.h: In instantiation of '__gnu_cxx::__numeric_traits<double>':
/home/paolo/Gcc/svn-dirs/trunk-install/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/tr1/random.tcc:731: instantiated from here
/home/paolo/Gcc/svn-dirs/trunk-install/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/ext/type_traits.h:134: error: ISO C++ forbids initialization of member constant '__gnu_cxx::__numeric_traits<double>::__min' of non-integral type 'const double'
/home/paolo/Gcc/svn-dirs/trunk-install/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/ext/type_traits.h:135: error: ISO C++ forbids initialization of member constant '__gnu_cxx::__numeric_traits<double>::__max' of non-integral type 'const double'


Note that the warning is *not* suppressed by the pragma system headers, I'm afraid we have to factor out the numeric_traits class...

Paolo.


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