Good evening , We created a std:::set<node **, iterator_pointer> where node is
defined by this class: class node{
public:
Range value;
//value stored in the node
node *next;
//pointer to next node
node *prev;
//pointer to previous node
node(){ next = NULL; prev = NULL; }
node(Range r){ value = r; next = NULL; prev = NULL; }
~node();
};
and iterator_pointer is defined by the struct: struct iterator_pointer
{ bool operator()(node** r1, node** r2) const{
if (*r1 == 0 || *r2 == 0){
return false;
}
return ((*r1)->value.high() < (*r2)->value.high());
}
For some unknown reason when we only insert one pointer to pointer
(node**) into the std::set<node**, iterator_pointer>. When we try
inserting multiple unique pointer to pointers(node __), the size of
the std:set<node**, iterator_pointer> stays the same.
We tried stepping into STL template code but we couldn't
determine why the size of std:Set does not continue increasing for
each successive unique node** insert. Are we doing something wrong or
is not possible to insert multiple unique keys correctly. Here
is an example of our STL set insert:
ranges_type.insert(&(myaccesses->getFront())) where myaccesses is a
doubly linked list of the class node shown earlier. Thank you.
defined by this class: class node{
public:
Range value;
//value stored in the node
node *next;
//pointer to next node
node *prev;
//pointer to previous node
node(){ next = NULL; prev = NULL; }
node(Range r){ value = r; next = NULL; prev = NULL; }
~node();
};
and iterator_pointer is defined by the struct: struct iterator_pointer
{ bool operator()(node** r1, node** r2) const{
if (*r1 == 0 || *r2 == 0){
return false;
}
return ((*r1)->value.high() < (*r2)->value.high());
}
For some unknown reason when we only insert one pointer to pointer
(node**) into the std::set<node**, iterator_pointer>. When we try
inserting multiple unique pointer to pointers(node __), the size of
the std:set<node**, iterator_pointer> stays the same.
We tried stepping into STL template code but we couldn't
determine why the size of std:Set does not continue increasing for
each successive unique node** insert. Are we doing something wrong or
is not possible to insert multiple unique keys correctly. Here
is an example of our STL set insert:
ranges_type.insert(&(myaccesses->getFront())) where myaccesses is a
doubly linked list of the class node shown earlier. Thank you.