When I was compiling a C++ program using icc 11, it gave this warning:
warning #21: type qualifiers are meaningless in this declaration
typedef const direction_vector_ref_t direction_vector_cref_t;
It is saying const just meaningless. I am curious about this since if this typedef expands it will turn into const array<double,3>& and the const is definitely meaningful. Why it gave this warning?
Are you sure? Try:
The issue here, is that when you use a typedef, it conceptually adds parentheses around the type, so you are conceptually using
const (array<double, 3>&)as opposed to(const array<double, 3>)&, so you are not actually making the referent object constant. So your declaration is more like:And in the above, the const for the variable (rather than the referent type) needs to be deferred till later.