[LLVMdev] name collision - llvm::tie and boost::tie

Vladimir Prus ghost at cs.msu.su
Thu Sep 22 23:26:18 PDT 2005

On Thursday 22 September 2005 19:12, Chris Lattner wrote:
> On Thu, 22 Sep 2005, Tzu-Chien Chiu wrote:
> > On 22/09/05, Bill Wendling <isanbard at gmail.com> wrote:
> >> Couldn't you state the explicit namespaces. So not using "using
> >> namespace llvm" and instead prefix all calls with "llvm::"?
> >
> > The header files in boost do not use fully-qualified tie(). I probably
> > should not modify them. But my .cpp file #include them.
> That should be fine if they are in a namespace boost {}.
> > I hope I could "using namespace"  boost and llvm in .cpp file, because
> > it's tedious to use fully-qualified identifiers in boost and llvm
> > namespace.
> Add:
> using boost::somethingyoucareabout;
> using boost::somethingelseyoucareabout;
> using namespace llvm;
> Or whatever you prefer.  This way you only import the symbols you want.

In fact, I believe that

   using namespace llvm;
   using namespace boost;
   using boost::tie;

should resove the problem witout needed to explicitly nominate all boost names 
you use. Except that this does not work on global scope, but only in 

   namespace Tzu_Chien_Chiu
           using namespace llvm;
           using namespace boost;
           using boost::tie;

		   void func() {  // Use 'tie'. }

You can see "The C++ programming language", section C.10 for details.

- Volodya

More information about the llvm-dev mailing list