Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #7657

Re: Slicing with ?: operator - expected?

From Victor Bazarov <v.bazarov@comcast.invalid>
Newsgroups comp.lang.c++
Subject Re: Slicing with ?: operator - expected?
Date 2011-07-08 15:56 -0400
Organization A noiseless patient Spider
Message-ID <iv7ndt$f33$1@dont-email.me> (permalink)
References <iv1p6s$acb$1@dont-email.me> <Xns9F1AAF6315183jgreerdoubletakecom@88.198.244.100>

Show all headers | View raw


On 7/6/2011 5:14 PM, Joe Greer wrote:
> Victor Bazarov<v.bazarov@comcast.invalid>  wrote in news:iv1p6s$acb$1@dont-
> email.me:
>
>>
>>      void foo(const Foo* pFoo)
>>      {
>>         (pFoo ? *pFoo : Foo1()).bar(); // line 19 ************
>>      }
>>
>
> I wonder if it isn't the *pFoo that is doing the slicing since we are
> dealing with a type const Foo* in the argument list.

Doing slicing where?  On its way into the 'foo' function?  Certainly 
not.  If I rewrite the ?: with 'if-else' syntax, I get the dynamic dispatch.

V
-- 
I do not respond to top-posted replies, please don't ask

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Slicing with ?: operator - expected? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-06 09:50 -0400
  Re: Slicing with ?: operator - expected? Michael DOUBEZ <michael.doubez@free.fr> - 2011-07-06 07:41 -0700
    Re: Slicing with ?: operator - expected? Michael DOUBEZ <michael.doubez@free.fr> - 2011-07-06 07:50 -0700
  Re: Slicing with ?: operator - expected? Bart van Ingen Schenau <bart@ingen.ddns.info> - 2011-07-06 16:41 +0200
    Re: Slicing with ?: operator - expected? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-06 11:37 -0400
      Re: Slicing with ?: operator - expected? "Balog Pal" <pasa@lib.hu> - 2011-07-06 23:17 +0200
  Re: Slicing with ?: operator - expected? Joe Greer <jgreer@doubletake.com> - 2011-07-06 21:14 +0000
    Re: Slicing with ?: operator - expected? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-08 15:56 -0400
      Re: Slicing with ?: operator - expected? Joe Greer <jgreer@doubletake.com> - 2011-07-11 16:35 +0000
        Re: Slicing with ?: operator - expected? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-07-11 13:05 -0400
  Re: Slicing with ?: operator - expected? "Paul" <pchristor@yahoo.co.uk> - 2011-07-07 01:47 +0100

csiph-web