RE: [boost] Re: boost::any: explicit constructor?

I guess I don't understand the whole concept now. T* -> void* sounds like "narrowing", since it loses information. int -> long never loses information, so "widening" makes sense to me. What is the criterion?
This is why I like C++'s choice of base and derived, there's never any confusion. You have the concepts of narrowing and widening correct but backwards. You narrow a type to a more specific derived type and widen one to a more general base type. Glen

Glen wrote:
I guess I don't understand the whole concept now. T* -> void* sounds like "narrowing", since it loses information. int -> long never loses information, so "widening" makes sense to me. What is the criterion?
This is why I like C++'s choice of base and derived, there's never any confusion. You have the concepts of narrowing and widening correct but backwards. You narrow a type to a more specific derived type and widen one to a more general base type.
That is why we should always use "covariant" and "contravariant" conversions, instead of (the proper but potentially confusing - if the reader is in "number of bits" mode) "narrowing" and "widening." This confusion leads to a shock when encountering the pointer-to-pointer conversions in C++. One has to understand the oscillation between covariance and contravariance when the indirections are traversed. I will personally spam the next writer using "narrowing" or "widening" ;-) /David

At Saturday 2004-02-28 12:39, you wrote:
Glen wrote:
I guess I don't understand the whole concept now. T* -> void* sounds like "narrowing", since it loses information. int -> long never loses information, so "widening" makes sense to me. What is the criterion?
This is why I like C++'s choice of base and derived, there's never any confusion. You have the concepts of narrowing and widening correct but backwards. You narrow a type to a more specific derived type and widen one to a more general base type.
That is why we should always use "covariant" and "contravariant"
oh yeah, covariant and contravariant are pellucidly clear </extreme sarcasm> they also differ by only 3 letters (in the middle) and are hard to read
conversions, instead of (the proper but potentially confusing - if the reader is in "number of bits" mode) "narrowing" and "widening."
This confusion leads to a shock when encountering the pointer-to-pointer conversions in C++. One has to understand the oscillation between covariance and contravariance when the indirections are traversed.
I will personally spam the next writer using "narrowing" or "widening" ;-)
/David
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"

I wrote:
That is why we should always use "covariant" and "contravariant"
Victor responded:
oh yeah, covariant and contravariant are pellucidly clear </extreme sarcasm> they also differ by only 3 letters (in the middle) and are hard to read
Actually the start tag of the "extreme sarcasm" element started around two lines above your reply ;-) /David

At Saturday 2004-02-28 21:06, you wrote:
I wrote:
That is why we should always use "covariant" and "contravariant"
Victor responded:
oh yeah, covariant and contravariant are pellucidly clear </extreme sarcasm> they also differ by only 3 letters (in the middle) and are hard to read
Actually the start tag of the "extreme sarcasm" element started around two lines above your reply ;-)
PtL! I guess I shouldn't have taken that speed reading class, I sped right past it. :)
/David
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"
participants (3)
-
David Bergman
-
Glen Knowles
-
Victor A. Wagner Jr.