franktakes / teexgraph

C++ library for large-scale network analysis and computation
GNU General Public License v3.0
24 stars 8 forks source link

Arrange project for use as a library #8

Closed r-barnes closed 3 years ago

r-barnes commented 3 years ago

This PR rearranges the project so it can be easily used as a library.

This involves several steps:

  1. Public header files are relocated to include/teexgraph. This creates an include namespace so that downstream projects, and teexGraph itself, include header files from teexGraph using, eg, #include <teexgraph/Graph.h>.
  2. namespace teexgraph { ... } is used in the header files to avoid namespace conflicts between teexgraph and other libraries a downstream project might include. For instance, Graph is probably a very common class name, but teexgraph::Graph is almost certainly unique. using namespace teexgraph can be used within cpp files to reduce verbosity.
  3. using namespace std is removed from header files. Having a using namespace in a header file is considered a bad anti-pattern (link, link, link
  4. #pragma once is added to some header files. This is a short-hand way of writing header guards which, while not ISO C++, does work with all compilers I'm aware of.
franktakes commented 3 years ago

I am aware of the controversies regarding using namespace std; and agree that in header files of a project that to be reusable, which is the direction in which teexgraph is developing, it's no good. So thanks for this!

franktakes commented 3 years ago

It seems like there is a conflict. Is there and easy way for you to fix this, as I am not sure how to commit to your code at this point.

r-barnes commented 3 years ago

@franktakes : I've updated to resolve the conflict. I'm happy to do that for any of my conflicting branches.