
From: "Jonathan Turkanis" <technews@kangaroologic.com>
"Rob Stewart" <stewart@sig.com> wrote in message:
From: "Jonathan Turkanis" <technews@kangaroologic.com>
I stole this idiom from John Maddock: http://tinyurl.com/4no5s. It's supposed to make insertion in the middle easier. I think it's the vector vs. list tradeoff.
It fails to make insertion in the middle easy, at least comparatively. Start with:
Yours/John's Mine enum { name_a = 1, 1<<0, name_b = name_a << 1, 1<<1, name_c = name_b << 1 1<<2 };
Now add name_x after name_b:
enum { name_a = 1, 1<<0, name_b = name_a << 1, 1<<1, name_x = name_b << 1, 1<<2, name_c = name_x << 1 1<<3 };
Your version requires a more extensive change
True -- if there are only three enumerators!
How does the number of enumerators matter? -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;