graph class creation???
Hi, I've been using the graph library for a while now. I was finally able to run my first Kruskal's algorithm adapted to my own problem. I am not a expert in C++ so I would like to ask something. I was taught that you should keep the definitions in one file and the declarations in another file. Well, working with the boost graph lirary, do we have to do this as well???? It doesn't make sense to me to do this since I am already working with the headers of the boost graph library to have the declarations in a .h file. Therefore, I just created a file graph.cxx where I put the particular implementation that I'm using, the definitions of my own graph properties and so on. Is this correct? Thanks for your help. a^2
On Feb 17, 2006, at 7:27 PM, Alejandro Aragón wrote:
Hi, I've been using the graph library for a while now. I was finally able to run my first Kruskal's algorithm adapted to my own problem. I am not a expert in C++ so I would like to ask something. I was taught that you should keep the definitions in one file and the declarations in another file. Well, working with the boost graph lirary, do we have to do this as well???? It doesn't make sense to me to do this since I am already working with the headers of the boost graph library to have the declarations in a .h file. Therefore, I just created a file graph.cxx where I put the particular implementation that I'm using, the definitions of my own graph properties and so on. Is this correct?
If you need the definitions of your graph in a file other than graph.cxx, move them to a header. Generally, the more you can put in .cxx files the better. Doug
Doug Gregor wrote:
On Feb 17, 2006, at 7:27 PM, Alejandro Aragón wrote:
Hi, I've been using the graph library for a while now. I was finally able to run my first Kruskal's algorithm adapted to my own problem. I am not a expert in C++ so I would like to ask something. I was taught that you should keep the definitions in one file and the declarations in another file. Well, working with the boost graph lirary, do we have to do this as well???? It doesn't make sense to me to do this since I am already working with the headers of the boost graph library to have the declarations in a .h file. Therefore, I just created a file graph.cxx where I put the particular implementation that I'm using, the definitions of my own graph properties and so on. Is this correct?
If you need the definitions of your graph in a file other than graph.cxx, move them to a header. Generally, the more you can put in .cxx files the better.
Doug
Thanks for replying Doug. What I did in the end was to separate part of
the code in a header. Thus, my header looks like this:
#ifndef _GRAPH_H
#define _GRAPH_H
#include <iostream>
#include <fstream>
#include
participants (2)
-
Alejandro Aragón
-
Doug Gregor