Boost logo

Boost :

Subject: Re: [boost] How best to implement a bitfield in C++ 14?
From: charleyb123 . (charleyb123_at_[hidden])
Date: 2016-02-05 08:38:45


>
> Gottlob Frege sayeth:
> > Well, you could still pass flag::none - the function address - to
> > flag::operator&().
> > But of course you could then pass any function - with the same signature
> -
> > so none() might need a signature like none(some_special_type unused = 0)
> to
> > prevent mistaken misuse.
> >
> > Does that help?
>
>
Nial Douglass respondeth:

> I thought of this too (specifically some_special_type<bits set for
> this flag>), but I realised I was getting into metaprogramming land.
>
> I'm sure a "perfect" typesafe bitfield can finally be implemented as
> of C++ 14, but I think the likely implementation should be submitted
> as a N-paper to WG21 as an excellent example of what needs to be
> fixed in the C++ language. After all, typesafe bitfields ought to in
> a systems programming language!
>
> A conference talk on building one of these might be very interesting
> ... nudge nudge! :)
>

+1

A "perfect typesafe bitfield" is very high value, and would make a great
conference talk.

--charley


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