Closed r-barnes closed 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!
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.
@franktakes : I've updated to resolve the conflict. I'm happy to do that for any of my conflicting branches.
This PR rearranges the project so it can be easily used as a library.
This involves several steps:
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>
.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, butteexgraph::Graph
is almost certainly unique.using namespace teexgraph
can be used within cpp files to reduce verbosity.using namespace std
is removed from header files. Having ausing namespace
in a header file is considered a bad anti-pattern (link, link, link#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.