Thread View: comp.lang.c++.leda
1 messages
1 total messages
Started by Ashvin Kannan
Mon, 07 Aug 1995 21:25
Bug with GRAPH for 3.1.2?
Author: Ashvin Kannan
Date: Mon, 07 Aug 1995 21:25
Date: Mon, 07 Aug 1995 21:25
59 lines
1684 bytes
1684 bytes
Hello,
I'm having a problem for which I have ABSOLUTELY no clue on how to
solve/workaround. Maybe I'm making a mistake, which someone can spot.
Enclosed at the end of the mail is an example of code using GRAPH. When
"mytype" is "typedef"ed to int, I get the correct results:
------------
32 0 1
8 0 1
------------
However, if I typedef mytype to unsigned char (which is what I want),
I get the following:!!
------------
0 0 1
0 0 1
------------
I'm using LEDA 3.1.2 with g++ 2.6.3. Thanks for any input/help!
Ashvin
======================================================================
#include <LEDA/graph.h>
typedef unsigned char mytype;
class fooC
{
public:
mytype a;
};
int main()
{
GRAPH<int,fooC> G;
G.clear();
node *nodes = new node[2];
nodes[0] = G.new_node(0);
nodes[1] = G.new_node(1);
fooC *foos = new fooC[2];
foos[0].a = 32;
foos[1].a = 8;
G.new_edge(nodes[0], nodes[1], foos[0]);
G.new_edge(nodes[0], nodes[1], foos[1]);
edge e;
node n;
forall_nodes(n, G)
forall_adj_edges(e, n)
cout << (int) G[e].a << " " <<
"\t" << G[source(e)] << " " << G[target(e)] << "\n";
}
======================================================================
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads