Issue |
133111
|
Summary |
[libc++] Investigate how we create iterators in bitset
|
Labels |
libc++
|
Assignees |
|
Reporter |
ldionne
|
I am tempted to see whether we can introduce `__begin()` and `__end()` functions instead, and get rid of `__make_iter` entirely. I'd imagine something like
```
iterator __begin() { return /* __make_iter(0); */ }
iterator __end() { return /* __make_iter(_Size); */ }
// and then here's an example usage
// OLD:
std::copy_backward(__base::__make_iter(0), __base::__make_iter(_Size - __pos), __base::__make_iter(_Size));
// NEW:
std::copy_backward(__begin(), __end() - __pos, __end());
```
Now the main question IMO is whether `__end() - __pos` produces equivalent code. I think we'll end up calling https://github.com/llvm/llvm-project/blob/52f941adbc2815487a0582ffedf3fb8cebe9cedd/libcxx/include/__bit_reference#L368, which might not produce efficient code. I still think we should investigate that since that looks like the way we'd want to write our code at a high level.
_Originally posted by @ldionne in https://github.com/llvm/llvm-project/pull/121312#discussion_r2014484606_
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs