Eric Lemings wrote:
-----Original Message-----
From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sebor
Sent: Thursday, June 26, 2008 5:45 PM
To: dev@stdcxx.apache.org
Subject: implementation of Unary Traits
The implementation of Unary Traits (e.g., is_void) uses explicit
specialization on all four combinations of cv-qualifiers for each
trait (plain, const, volatile, and const volatile). I'm wondering
if the alternative approach of stripping the qualifiers before
"dispatching" to just one explicit specialization has been
considered. The potential advantage of this approach is fewer
declarations, smaller translation units, and thus (presumably)
faster compilation.
Though I'm using a relational (binary) type trait, I'm getting warnings
because the cv-qualifiers are not being stripped.
A test case is always helpful:
#include <type_traits>
int main ()
{
return !std::is_convertible<const int, int>::value;
}
Seems like is_convertible might need to strip top-level cv qualifiers
from the types. What do you think, Travis?
Martin
gcc -c -I/work/stdcxx/branches/4.3.x/include/ansi -D_RWSTDDEBUG
-pthread -I/work/stdcxx/branches/4.3.x/include
-I/build/stdcxx-4.3.x-15D/include
-I/work/stdcxx/branches/4.3.x/tests/include -std=gnu++0x
-D_RWSTD_EXT_CXX_0X -W -Wall -Wcast-qual -Winline -Wshadow
-Wwrite-strings -Wno-long-long -Wcast-align
/work/stdcxx/branches/4.3.x/tests/utilities/20.tuple.cnstr.cpp
/work/stdcxx/branches/4.3.x/include/rw/_meta_rel.h: In
instantiation of '__rw::__rw_is_convertible_impl<const int, int>':
/work/stdcxx/branches/4.3.x/include/rw/_meta_rel.h:93:
instantiated from '__rw::__rw_is_convertible_3<const int, int, false,
false>'
/work/stdcxx/branches/4.3.x/include/rw/_meta_rel.h:122:
instantiated from '__rw::__rw_is_convertible_2<const int, int, false>'
/work/stdcxx/branches/4.3.x/include/rw/_meta_rel.h:145:
instantiated from '__rw::__rw_is_convertible_1<const int, int, false,
false>'
/work/stdcxx/branches/4.3.x/include/rw/_meta_rel.h:163:
instantiated from '__rw::__rw_is_convertible<const int, int>'
/work/stdcxx/branches/4.3.x/include/tuple:68: instantiated
from 'std::tuple<const int>::_C_is_compatible<int>'
/work/stdcxx/branches/4.3.x/include/tuple:123: instantiated
from 'std::tuple<_Types>::tuple(_TypesU&& ...) [with _TypesU = int,
_TypesT = const int]'
/work/stdcxx/branches/4.3.x/tests/utilities/20.tuple.cnstr.cpp:103:
instantiated from here
/work/stdcxx/branches/4.3.x/include/rw/_meta_rel.h:77: warning:
type qualifiers ignored on function return type
Brad.