/*
 * This file was automatically generated by sel-utils and
 * released under the MIT License.
 * 
 * License: https://github.com/sel-project/sel-utils/blob/master/LICENSE
 * Repository: https://github.com/sel-project/sel-utils
 */
module sul.utils.metadataflags;

import std.bitmanip : bitfields;
import std.conv : to;

union MetadataFlags(T) {

    T value;

    struct { mixin(bitfields!(bits!T)); }

    alias value this;

}

private alias bits(T) = bitsImpl!(0, T.sizeof * 8);

private template bitsImpl(size_t index, size_t length, E...) {
    static if(index < length) {
        alias bitsImpl = bitsImpl!(index + 1, length, E, bool, "_" ~ to!string(index), 1);
    } else {
        alias bitsImpl = E;
    }
}