[llvm-bugs] [Bug 24435] bitset::const_reference is an extension
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 12 10:46:23 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24435
Marshall Clow (home) <mclow.lists at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WONTFIX
--- Comment #1 from Marshall Clow (home) <mclow.lists at gmail.com> ---
Yes, it is an extension.
The purpose is to increase consistency among the containers.
Consider the following code (from Howard):
#include <vector>
#include <bitset>
#include <cassert>
template <class Container>
void
test(Container& c, Container const& cc)
{
using const_ref = typename Container::const_reference;
assert(&c == &cc);
const_ref cr = cc[0];
assert(cr == c[0]);
c[0] = 1;
assert(cr == c[0]);
}
int
main()
{
std::vector<char> vc{1};
test(vc, vc);
std::bitset<1> bs;
test(bs, bs);
std::vector<bool> vb{1};
test(vb, vb);
}
This compiles and runs w/o error in libc++.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150812/b1d6c78e/attachment.html>
More information about the llvm-bugs
mailing list