|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 1999-12-22 18:05:32
I've been playing around with an alternate implementation of is_const,
and was wondering what if any compilers might support it:
template <typename T> struct remove_const {typedef T type;};
template <typename T> struct remove_const<T const> {typedef T type;};
template <typename T, typename U> struct is_same {static const bool
type = false;};
template <typename T> struct is_same<T, T> {static const bool
type = true;};
template <typename T> struct is_const
{static const bool type = !is_same<T, remove_const<T>::type>::type;};
#include <iostream>
int main()
{
std::cout << is_const<const int>::type << '\n';
}
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk