const-iterator
Technique for factoring find like methods?
I am looking for a technique to factor find like methods. The problem is the following. I need a find method on a container that does not need to modify the container contents to do the search. Howeve[详细]
2023-04-04 03:48 分类:问答STL rotating const_iterators of unique_ptrs
I have problems using std::rotate on a const_iterator over a unique_ptr middle. I have tried: std::vector<std::unique_ptr<Object> >::const_iterator middle;[详细]
2023-03-21 06:28 分类:问答How's the thing iterated over called?
I wanted to express that an iterator is const (i.e you cannot increment or decrement it) but that the thing it yields is non-const:[详细]
2023-03-12 04:23 分类:问答Are const_iterators faster?
Our coding guidelines prefer const_iterator, because they are a little faster compared to a normal iterator. It seems like the compiler optimizes the code when you use const_iterator.[详细]
2023-02-25 22:33 分类:问答c++ function with max_element & iterator = 3x slower
The program I am developing gets three times slower when I call the following function. It wouldn\'t be bad if it was not called a couple million of times.[详细]
2023-02-13 09:10 分类:问答C++ iterator and const_iterator problem for own container class
I\'m writing an own container class and have run into a problem I can\'t get my head around. Here\'s the bare-bone sample that shows the problem.[详细]
2022-12-30 17:14 分类:问答Constant correctness
In the printMessage if you access the vector of a constant class using the index it works fine, but not with the the iterator (*itr). If the iterator is declared as constant_iterator then it works fin[详细]
2022-12-20 02:16 分类:问答