Hi Rene, et al,
Rene Brun <Rene.Brun@cern.ch> wrote concerning
Re: [ROOT] TH1I [Mon, 08 Sep 2003 14:26:29 +0200]
----------------------------------------------------------------------
> #include <vector>
> using namespace std;
>
> class Analysis {
> private:
> vector<TH1S*>* m_particleLevelsHist;
> };
>
> solution2
> =========
> #include <TROOT.h>
> #include <TH1.h>
> #include <vector>
>
> class Analysis {
> private:
> std::vector<TH1S*>* m_particleLevelsHist;
> };
In general, it's better not to import (`use' declarations) namespaces
into header files that might be imported into other applications, as
you effectively pollute the namespace of that client application.
Suppose you had
// some_header
namespace bar {
struct foo;
}
// some_other_header
# include <some_header>
use namespace bar;
and some client code has
// client.hh
namespace baz {
struct foo;
}
// client.cc
#include <some_other_header>
#include <client.hh>
You'll then needlessly make this in-compilable. Hence, I'd recommend
using fully qualified identifiers in (possibly shared) headers, and
only use import namespaces into compiled objects (source files).
Just my 2 cents worth.
Yours,
___ | Christian Holm Christensen
|_| | -------------------------------------------------------------
| | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91
_| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91
_| Denmark Office: (+45) 353 25 305
____| Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
| |
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET