
3 Jun
2010
3 Jun
'10
4:30 p.m.
Tom wrote:
endian::cast<big_to_host>() //explicit direction endian::cast<from_litle>() //"to_host" is implicit endian::cast<to_big>() //"from_host" is implicit
I actually really like that. What do you think?
Is it imporant that these names are templated? What are the advantages of this templated-tagged design over.. endian::cast_big_to_host() endian::cast_from_little() endian::cast_to_big() where the functions are only templated on the object type. template<class T> T cast_big_to_host(const T& x); template<class T> T cast_from_big(const T& x) { return cast_bit_to_host(x); } Although, I strongly disagree with T both as an argument and as a return value of a "cast". terry