Age | Commit message (Collapse) | Author |
|
Add a method that allows a MutableSpan to reverse itself. This reverses
the data in the original span object. This is a first step in extracting
some functionality from nodes and making it more general.
Differential Revision: https://developer.blender.org/D12485
|
|
|
|
This is quite convenient sometimes and is available for `std::vector` as well.
|
|
Some conversions that should work did not work before.
For example, `MutableSpan<int *> -> MutableSpan<const int *>`.
|
|
Previously, methods like `Span.drop_front` would crash when more
elements would be dropped than are available. While this is most
efficient, it is not very practical in some use cases. Also other languages
silently clamp the index, so one can easily write wrong code accidentally.
Now, `Span.drop_front` and similar methods will only crash when n
is negative. Too large values will be clamped down to their maximum
possible value. While this is slightly less efficient, I did not have a case
where this actually mattered yet. If it does matter in the future, we can
add a separate `*_unchecked` method.
This should not change the behavior of existing code.
|
|
Motivated by `std::string_view` being usable in
const (compile-time) context.
One functional change was needed for StringRef:
`std::char_traits<char>::length(str)` instead of `strlen`.
Reviewed By: JacquesLucke, LazyDodo
Differential Revision: https://developer.blender.org/D9788
|
|
This error happened only with O2 or O3 in my tests.
Casting to uintptr_t and back seems to quiet the compiler.
|
|
The new reverse iterators behave as the reverse iterators for contains from
the standard library. Have a look at the tests to see how to use them.
Using them will hopefully become easier with ranges in C++20.
A Vector can now be constructed from two iterators, which is very common
in the standard library.
New Vector.insert methods allow adding elements in the middle of a vector.
These methods should not be used often in practice, because they has a linear running time.
New Vector.prepend methods allow adding elements to the beginning of a vector.
These methods are O(n) as well.
|
|
|
|
|
|
Reviewers: sybren
Differential Revision: https://developer.blender.org/D8315
|