[Issue 12489] std.bitmanip byte swapping routines should be partially instantiable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 29 04:32:32 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12489



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-29 12:32:30 CET ---
Here's a somewhat generic wrapper workaround:

-----
template PartialTempl(alias templ, T...)
{
    auto PartialTempl(Args...)(auto ref Args args)
    {
        return templ!T(args);
    }
}
-----

Usable as:


-----
@Converter!(PartialTempl!(littleEndianToNative, ushort))
ushort reserved1;
-----

Of course 'littleEndianToNative' and friends take a ubyte[N], not a ushort, so
in my file loading routine I have to take that into account. But using
attributes is pretty nice.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list