Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Endian - template requirements and scope
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-09-07 15:17:14


On Tue, Sep 6, 2011 at 3:39 PM, Vicente J. Botet Escriba
<vicente.botet_at_[hidden]> wrote:
> Hi,
>
> I have not found the requiremenst of the endian class template parapeter T
> and conversion functions. What are they?

For class endian, T must be an signed or unsigned integer type. See
3.9.1. A UDT that provided the same operations would work, but I'm no
sure that it is possible to write such a class. Support for promotion
might be difficult, for example. Since I know of no real-world use
cases for UDT's, I don't want to waste a lot of time trying to
determine if they work or not. If we had concepts it would be a
different story, but that's water over the dam.

For the conversion functions, the answer is more up-in-the-air. In
light of comments received, there may be some interface churn with
these functions.

> Could them be added to the documentation?

Definitely. Added to do-list.

> I have not found a tutorial on how to use the endian conversions. Could you
> give an example that shows how easy is to use them with UDT? Collections of
> UDT?

They weren't designed with UDT's in mind, but there are likely to be
only a few requirements, and those requirements could probably be met
by a UDT.

> Could the user overload the conversion functions for UDT?
>
> While the predefined endian types are useful I guess that the user could
> instantiate the endian class with a UDT, isn't it? Could you post a working
> example and add it to the documentation?

See above. I really want to see real-world use cases before putting in
any effort.

> The scope of Boost.Endian is integer types. Aren't floating point types and
> endianness related? If the scope of the library is limited to integers,
> maybe Integer.Endian could be a better name?

That was the original plan, but I found it easier to not try to
integrate with the stuff that is already in integer. No big thing one
way or the other.

Good questions - thanks,

--Beman


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