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: 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
Andreas Fredriksson
2005-Sep-23 07:07 UTC
[LLVMdev] name collision - llvm::tie and boost::tie
On 9/23/05, Vladimir Prus <ghost at cs.msu.su> wrote:> 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:<SNIP> Also, it might be an idea to exploit Koenig lookup if either `tie' function is a free function and uses types from its own namespace. If these definitions hold: namespace foo { struct bar {}; do_something(const bar&); } You can call do_something() without the namespace qualification due to Koenig lookup. (global namespace) using foo::bar; bar b; do_something(b); // resolves to foo::do_something() Maybe this helps. Regards, Andreas -- "Give a man a fire and he's warm for a day; set him on fire and he's warm for the rest of his life" -- Terry Pratchett
On Friday 23 September 2005 11:07, Andreas Fredriksson wrote:> On 9/23/05, Vladimir Prus <ghost at cs.msu.su> wrote: > > 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: > > <SNIP> > > Also, it might be an idea to exploit Koenig lookup if either `tie' > function is a free function and uses types from its own namespace.This is getting off-topic for this list, but ADL (aka. Koenig lookup) won't help with "tie", because 'tie' is mostly called on std::pair. - Volodya
Apparently Analagous Threads
- [LLVMdev] name collision - llvm::tie and boost::tie
- [LLVMdev] name collision - llvm::tie and boost::tie
- [LLVMdev] name collision - llvm::tie and boost::tie
- [LLVMdev] name collision - llvm::tie and boost::tie
- [LLVMdev] name collision - llvm::tie and boost::tie