Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Problem w/ C++ using declaration in namespaces
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

o2a
Junior Member

24 Posts

Posted - Jan 25 2006 :  09:49:25 AM  Show Profile  Reply with Quote
While we are at C++ namespaces now - here is another problem I noticed when using the boost::tuples lib.

From it's docu:
"All definitions are in namespace ::boost::tuples, but the most common names are lifted to namespace ::boost with using declarations."

So e.g. ::boost::tuples::make_tuple(...) is aliased as ::boost::make_tuple(...). But when using these full-qualified forms, only the former is recognized by VAX, not the latter aliased form.

It turns out, that VAX doesn't seem to recognize identifiers which are using-declared in a namespace when you access them with the full qualified form. On the other hand, if you do without full qualification by putting in a using directive for that namespace, VAX works correctly.

(Please note: not a using directive for the original namespace of the identifier, but for the other namespace containing the using declaration. Of course both will work, but the interesting fact is, that VAX doesn't have a problem with the inner using declaration itself but with the qualification of the containing namespace.)

Example:

namespace test1
{
	void testfunc1(){}
}

namespace test2
{
	using ::test1::testfunc1;
}

void testfunc3()
{
	::test1::testfunc1();	// correctly recognized by VAX
	::test2::testfunc1();	// not recognized by VAX
}

void testfunc4()
{
	using namespace test2;
	testfunc1();			// now correctly recognized by VAX
}

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jan 25 2006 :  5:46:08 PM  Show Profile  Reply with Quote
i had to re-read this one a few times to get it straight in my own head, probably because i never normally use namespaces in my code. thank you for the clear example, i am not sure where i would have started with this.

case=972

zen is the art of being at one with the two'ness
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jan 17 2007 :  3:44:06 PM  Show Profile  Reply with Quote
Fixed in 1544.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000