bitset assignment

From: Andy Skypeck (
Date: 12/03/03

Date: 3 Dec 2003 08:45:34 -0800

I have a question concerning the use of the [] operator in bitset

bitset<4> a("1100");
bitset<4> b("0011");

a[i] = a[j];

Is clearly supported by the standard, and works with all the C++
compilers I have worked with. But what about

a[i] = b[j]; // ?

Assume that there are no indices out of range.
This works with gcc-3.* and MSVC 6 and higher but fails on an older
Borland compiler. I contend that this is ok because both a[i] and
b[j] return type bitset<N>::reference. Others say no, but for
unspecified reasons. Does anybody
have an authoritative answer?