Comments (2)
The following should work:
int main() {
tsl::ordered_map<int, int> map = {{0, 2}, {1, 3}};
for (auto it = map.rbegin(); it != map.rend(); ++it) {
it.base().value() = 1;
}
}
from ordered-map.
I just realised in the base()
documentation that The base iterator refers to the element that is next (from the std::reverse_iterator::iterator_type perspective) to the element the reverse_iterator is currently pointing to.
The above will thus not work as expected, I need to check if there's a better solution.
Something like:
(it.base() - 1).value() = 1;
would work but is very cumbersome and unintuitive.
from ordered-map.
Related Issues (20)
- Build with -fno-exceptions . HOT 7
- tsl::ordered_map<int, const std::string> failed to compile HOT 4
- Visual Studio 2017 and ordered-map HOT 3
- Runtime error HOT 4
- 64 bit bucket_entry HOT 3
- Packaging for conda HOT 8
- Insertion by iterator throws a compile error if a const iterator is used HOT 1
- serialization HOT 2
- Add lower_bound function HOT 1
- Non-const dereferencing HOT 4
- Serialize with boost and C++11/14 HOT 2
- How to get an element by a random number? HOT 1
- Eliminating the difference in what an iterator yields HOT 5
- Add erase_if function
- `tsl::ordered_set<bool>` with `std::vector` HOT 2
- Conflict with `Windows.h` HOT 1
- Corrupted map from using `insert_at_position` HOT 5
- Comparing keys between two tsl::ordered_map objects
- The ordered_map is crashed with map.earse(it++) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ordered-map.