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
 1533: operators and the using declaration
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

.oisyn
Tomato Guru

162 Posts

Posted - Sep 19 2006 :  08:43:03 AM  Show Profile  Reply with Quote
struct A
{
	void foo();
	void operator[](int) const { }
};

struct B : public A
{
	using A::foo;
	using A::operator[]; // #1
};


The keyword 'operator' in #1 shows with a red underline for some reason. Using the using declaration with regular functions works fine.

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Sep 23 2006 :  5:08:16 PM  Show Profile  Reply with Quote
confirmed.

case=2674

i had to go and look that one up to work out what you were doing

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

.oisyn
Tomato Guru

162 Posts

Posted - Sep 26 2006 :  07:02:21 AM  Show Profile  Reply with Quote
For the record ;) :

Well in my example it is pointless of course, but it's used to unhide base members if you're implementing the same function with a different signature in a derived class.

struct Base
{
    void operator() (int);
};

struct Derived : public Base
{
    using Base::operator();         // #1
    void operator() (const char *); // #2
};

void foo()
{
    Derived d;
    d(123);  // isn't possible without #1 as #2 hides all base members with the same name.
}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Oct 02 2006 :  11:47:12 AM  Show Profile  Reply with Quote
*ah* I ended up with a different idea, based on an example in More Effective C++ by Meyers, where "using" makes a private function from the base class public in the derived class.

this also makes sense.

zen is the art of being at one with the two'ness
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