diff --git a/doc/conversion.html b/doc/conversion.html index 339cc33..3ee5cb0 100644 --- a/doc/conversion.html +++ b/doc/conversion.html @@ -197,6 +197,11 @@ modifiable lvalue of type Reversible.

reversed. +

See +udt_conversion_example.cpp for an example of a UDT that can used in the +big_endian, +little_endian, and +convert function templates.

Functions

int16_t  reverse_value(int16_t x) noexcept;
 int32_t  reverse_value(int32_t x) noexcept;
@@ -331,7 +336,7 @@ provided.

support endian conversion as separate from endian integer types. Phil Endecott suggested the form of the value returning signatures. Vicente Botet and other reviewers suggested supporting floating point types and user defined types. General reverse template implementation approach using std::reverse suggested by Mathias Gaunard. Portable implementation approach for 16, 32, and 64-bit integers suggested by tymofey, with avoidance of undefined behavior as suggested by Giovanni Piero Deretta, and a further refinement suggested by Pyry Jahkola. Intrinsic builtins implementation approach for 16, 32, and 64-bit integers suggested by several reviewers, and by David Stone, who provided his Boost licensed macro implementation that became the starting point for boost/endian/detail/intrinsic.hpp.


Last revised: -28 May, 2013

+29 May, 2013

© Copyright Beman Dawes, 2011, 2013

Distributed under the Boost Software License, Version 1.0. See www.boost.org/ LICENSE_1_0.txt

diff --git a/example/udt_conversion_example.cpp b/example/udt_conversion_example.cpp index 34bf056..07186a5 100644 --- a/example/udt_conversion_example.cpp +++ b/example/udt_conversion_example.cpp @@ -59,13 +59,24 @@ int main(int, char* []) UDT x(1, 1.2345f, "Bingo!"); cout << std::hex; cout << x.id() << ' ' << x.value() << ' ' << x.desc() << endl; + reverse(x); cout << x.id() << ' ' << x.value() << ' ' << x.desc() << endl; + reverse(x); cout << x.id() << ' ' << x.value() << ' ' << x.desc() << endl; + big_endian(x); cout << x.id() << ' ' << x.value() << ' ' << x.desc() << endl; + little_endian(x); + cout << x.id() << ' ' << x.value() << ' ' << x.desc() << endl; + + convert(x); + cout << x.id() << ' ' << x.value() << ' ' << x.desc() << endl; + + convert(x, order::big, order::little); + cout << x.id() << ' ' << x.value() << ' ' << x.desc() << endl; } #include