Boost logo

Boost :

Subject: Re: [boost] [boost::endian] Summary of discussion #1
From: Terry Golubiewski (tjgolubi_at_[hidden])
Date: 2010-06-03 12:30:04


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk