const type;
C / C++ / MFC
3
Posts
3
Posters
0
Views
1
Watching
-
const
ness is a compile time hint.const int tata = 5;
...
tata = 4; // you will get a compile error.
Maximilien Lincourt Your Head A Splode - Strong Bad
-
If you mean "writing generic code which knows whether a given type is
const
or not" you can have something like that:template <class T>
my_generic_class
{
};// specialization for const types
template<class T>
my_generic_class<const T>
{
// implementation taking into account the type is const
}Other than that, Boost.TypeTraits[^] features an utility called
is_const
which determines at compile time theconst
ness of a type. I'm not sure if tihs is what you're after. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo Want a Boost forum in Code Project? Vote here[^]!