Mailinglist Archive: opensuse-programming (25 mails)
| < Previous | Next > |
Re: [opensuse-programming] C++ inheritance issue
- From: John D Lamb <J.D.Lamb@xxxxxxxxxxxxxx>
- Date: Mon, 30 Apr 2007 21:47:19 +0100
- Message-id: <1177966039.6959.7.camel@xxxxxxxxx>
On Mon, 2007-04-30 at 09:07 -0400, Jerry Feldman wrote:
> > My instinct says we've found alternative solutions to the same problem.
> > Mine avoids some problems with virtual function calls, but I suspect
> > there is going to be some occasion when it won't work.
> Hi John,
> I just changed the code from FuBar<ItemType, type_t>::i_key; to
> this->i_key, and that also resolved the issue. I appreciate your
> response on this.
I think the this->i_key version is probably better if it's available,
but, by chance, I found an example where it doesn't work in some code I
wrote a couple of years ago:
class NextTrail : private
Next<boost::graph_traits<cycleCentre::Graph>::vertices_size_type>{
...
};
bool
NextTrail::operator()( VertexTrail* trail ){
...
while( Next<boost::graph_traits<Graph>::vertices_size_type>::operator()() ){
...
}
...
}
I haven't worked out yet, why this doesn't work. Maybe its because of
the private inheritance, but it does show that using this->operator()()
isn't guaranteed to work.
--
JDL
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-programming+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-programming+help@xxxxxxxxxxxx
> > My instinct says we've found alternative solutions to the same problem.
> > Mine avoids some problems with virtual function calls, but I suspect
> > there is going to be some occasion when it won't work.
> Hi John,
> I just changed the code from FuBar<ItemType, type_t>::i_key; to
> this->i_key, and that also resolved the issue. I appreciate your
> response on this.
I think the this->i_key version is probably better if it's available,
but, by chance, I found an example where it doesn't work in some code I
wrote a couple of years ago:
class NextTrail : private
Next<boost::graph_traits<cycleCentre::Graph>::vertices_size_type>{
...
};
bool
NextTrail::operator()( VertexTrail* trail ){
...
while( Next<boost::graph_traits<Graph>::vertices_size_type>::operator()() ){
...
}
...
}
I haven't worked out yet, why this doesn't work. Maybe its because of
the private inheritance, but it does show that using this->operator()()
isn't guaranteed to work.
--
JDL
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-programming+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-programming+help@xxxxxxxxxxxx
| < Previous | Next > |