I can't get this to work. I want it to check for fundamental types but also for pointers of fundamental types:
template<typename T> struct non_void_fundamental :
boost::integral_constant<bool,
(boost::is_fundamental<T>::value && !boost::is_same<T, void>::value)
|| (boost::is_fundamental<*T>::value && !boost::is_same<*T, void>::value)
>
{ };
Maybe some one can help me point me in the right direction.
Edit: It is especially the 4th line which doesn't do what I want, the rest works fine.
Edit 2: The point would be that it generates the following output in the following example:
int* p = new int(23);
cout << non_void_fundamental<double>::value << endl // true
cout << non_void_fundamental<some_class>::value << endl // false
cout << non_void_fundamental<p>::value << endl // true
Edit 3: Thanks to Kerrek SB, I have this know, but it is producing some errors.
template<typename T> struct non_void_fundamental :
boost::integral_constant<bool,
(boost::is_fundamental<T>::value && !boost::is_same<T, void>::value)
|| (boost::is_pointer<T>::value && boost::is_fundamental<boost::remove_pointer<T>::type>::value && !boost::is_same<boost::remove_pointer<T>::type, void>::value)
>
{ };
Erros:
FILE:99:61: error: type/value mismatch at argument 1 in temp
late parameter list for 'template<class T> struct boost::is_fundamental'
FILE:99:61: error: expected a type, got 'boost::remove_poi
nter<T>::type'
FILE:99:125: error: type/value mismatch at argument 1 in tem
plate parameter list for 'template<class T, class U> struct boost::is_same'
FILE:99:125: error: expected a type, got 'boost::remove_po
inter<T>::type'