hello,
[edit: I forgot to mention that it is a JUnit Test Case i am debugging. Is that a problem?]
i have a really strange problem in eclipse.
(I am new to debugging in eclipse so post all what is in your mind...)
When i am at a certain line it just stops to go further in the code. It remains in the same line although i am pressing F6...
Saw this in wikipedia, this is what happens when you traverse an iterator via a foreach loop:
These methods are all being used in a
complete foreach( $object as
$key=>$value ) sequence. The methods
are executed in the following order:
rewind()
while valid() {
current() in $value
key() in $key
next()
}
End of L...
Okay, so long weekend away with Macbook I started making an asset loader for 2D game platforms, its working fine in xcode, but when I got home and tried and load it up on Windows I get a debug error.
Essentially what is happening is that the first call to the iterator works? the second doesn't, but only on the second attempt at calling ...
I have some code that looks like this:
std::set<int> s1, s2, out;
// ... s1 and s2 are populated ...
std::set_intersection(s1.begin(), s1.end(),
s2.begin(), s2.end(),
std::inserter(out, out.end()));
I've read inserts can be done in amortized constant time if the value being inserted to the...
Is it possible to merge iterators in Java? I have two iterators and I want to combine/merge them so that I could iterate though their elements in one go (in same loop) rather than two steps. Is that possible?
Note that the number of elements in the two lists can be different therefore one loop over both lists is not the solution.
Ite...
Is it possible to iterate a vector from the end to the begin?
for (vector<my_class>::iterator i = my_vector.end();
i != my_vector.begin(); /* ?! */ ) {
}
Or is that only possible with something like that:
for (int i = my_vector.size() - 1; i >= 0; --i) {
}
...
If I understand correctly, in Python 2, iter(d.keys()) was the same as d.iterkeys(). But now, d.keys() is a view, which is in between the list and the iterator. What's the difference between a view and an iterator?
In other words, in Python 3, what's the difference between
for k in d.keys()
f(k)
and
for k in iter(d.keys())
f...
I have a data class Student, and I have an aggregate class Students.
Student has two properties of type string : Name and City.
what I want to do is have the option to choose what property to iterate using the foreach mechanism.
The code I wrote works and it's also readable and nice-looking.
The main issue is performance : the line in...
I have a stl set of integers and I would like to iterate through all unique pairs of integer values, where by uniqueness I consider val1,val2 and val2,val1 to be the same and I should only see that combination once.
I have written this in python where I use the index of a list (clusters):
for i in range(len(clusters) - 1):
for j in...
Is there any existing iterator implementation (perhaps in boost) which implement some sort of flattening iterator?
For example:
unordered_set<vector<int> > s;
s.insert(vector<int>());
s.insert({1,2,3,4,5});
s.insert({6,7,8});
s.insert({9,10,11,12});
flattening_iterator<unordered_set<vector<int> >::iterator> it( ... ), end( ... );
for...
If Collection defines hasNext() instead of iterator().hasNext(), we could write loop easier:
while(collection.hasNext()){…}
instead of:
Iterator it= collection.iterator();
While(it.hasNext()){…}
Of course, I know easy way for loop for(E e:collection) exists.
Why interface Iterator exists?
...
hello i am trying to make a map containing objects as the following : class Employee >>dervied from Employee : are the following classes : Worker , Manager and ViceManage.
in my map i want to have the object Employee sorted by his ID which is char*
i tried to create a map like this:`
multimap<const string,Employee*> t1
t1<string,Employe...
Hi,
I'll try and keep my sample code very straightforward, but it may have errors as I'm typing it on the spot.
I have a class named Phone.
class Phone
{
public:
Phone(std::string manufacturer, std::string model, std::vector<Feature> features);
private:
std::vector<Features> features;
std::string model;
std::string manufactu...
I've modified James' flattening iterator to act as a bidirectional iterator if possible, but I don't think my changes are very elegant (particularly relying on a bool to see if the inner iterator has been set). However, I can't seem to come up with a nicer solution. Does anyone have any ideas?
#include <algorithm>
#include <iostream>
...
Hello, i'm using a multimap stl, i iterate my map and i did'nt find the object i wanted inside the map, now i want to check if my iterator holds the thing i wanted or not and i'm having difficulties with it because it's not null or something. thanx!
...
Hi everyone.
I was working again with C++ during the weekend and came to notice something that I'm not sure where does it come from.
Following the advice in this thread, I decided to implement a map_keys_iterator and map_values_iterator. I took the -- I think -- recommended-against approach of deriving a class from std::map<K,V>::itera...
How I can iterating over scala collections in java?
...
First of all I'm sorry if you feel this question has been raised before, but I can't seem to wrap my mind around this one, although it's rly not the hardest thing to do..
Basically I have a query result from sql which holds several rows, existing out of :
id, parentid, name, description, level
level is the depth of the item viewed as...
I'm using Boost.Range to pass around some data and a container class for this data. The data is loaded in a different thread and may in some cases not be ready yet. In this case the container is initialized with the default iterator_range, hence containing singular iterators. I'm doing assignments and copying of the data containers (henc...
which concept in c++ teaches you to extend and write your own iterator class? I know a little about writing templates.
...