220 17708 <3d85e7bb-0039-48d0-8f50-19cbd3c440ca@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: John Yates <john.yates.sheets@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: =?UTF-8?Q?=5Bstd=2Dproposals=5D_Re=3A_Proposal=3A_Class_static_=E2=80=9Cproper?=
	=?UTF-8?Q?ty=E2=80=9D_constants_in_vtables?=
Date: Tue, 5 May 2015 12:15:08 -0700 (PDT)
Lines: 107
Approved: news@gmane.org
Message-ID: <3d85e7bb-0039-48d0-8f50-19cbd3c440ca@isocpp.org>
References: <49c358a2-d19a-415f-a4fa-1ff67286a0ad@isocpp.org>
 <7b8abc94-1928-4f61-82c2-75711d0b7a50@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_5275_1046166535.1430853308825"
X-Trace: ger.gmane.org 1430853314 6500 80.91.229.3 (5 May 2015 19:15:14 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 5 May 2015 19:15:14 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDW2ZOHC5EGRBPNNUSVAKGQEXG4JPTI@isocpp.org Tue May 05 21:15:14 2015
Return-path: <std-proposals+bncBDW2ZOHC5EGRBPNNUSVAKGQEXG4JPTI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f197.google.com ([209.85.214.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDW2ZOHC5EGRBPNNUSVAKGQEXG4JPTI@isocpp.org>)
	id 1YpiJD-0001Tk-9y
	for gclcip-std-proposals@m.gmane.org; Tue, 05 May 2015 21:15:11 +0200
Original-Received: by obbkp3 with SMTP id kp3sf191998053obb.0
        for <gclcip-std-proposals@m.gmane.org>; Tue, 05 May 2015 12:15:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :content-type:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=zr7llp9W2vCDUVhRQobJCo/vVwExDyn2zP2n3a8MgPs=;
        b=mAbDPBBisv2z5Ti6Wi4369K8NEG8lBLJMN6koCsUgtjp3B8mhbQxW0d0ii15vBX5qC
         KvHkxCk994++Jo1S6daWQLF4G2SoPWcsaHDJKGGuASWUOYiF2ujeUhIHPPnmvGvF8nn3
         vn8I3bxaZm5uuo0MEVNv/D98phYVmEUTbmT1Z2acSrB0j0ORqJAVpc/6GkWxN3dnIZZv
         /nSG+walLcMwLKyTz3bl5l6bYT8OZ0tbcznTUJZZhsTTE0rQ9SNdhdwaEFUrEEEZl4lv
         XCSShBsebYMdcpu2ocETuodv6CveHjgGnKXT00rPO7bD4vKkH117HEm/2tjKR3qbCLVv
         mmVw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=zr7llp9W2vCDUVhRQobJCo/vVwExDyn2zP2n3a8MgPs=;
        b=YiuQBtdeBw5FAR+U1BJ0ttQSZRazL0dskywxEOkti+jVy4rWvY7tGENzZDSBC6W5lh
         oBkJemDe5wkFRHGfB7eLmucOHkyidgN1keFm8mBKqK3BVEQlV+vRa8knsNJ/AS2WiETk
         wCToIlWRcsELexLcQRq7hTgb/4+R43CDJcWL4kdmGdxpRA7tol5k+rVXi/toudBMpCOf
         PdDkVBG1zhPWzO8LjUahwBFWDchTumRVLndhSIDyEr4Hc0v7fI8nV86nIFZ+bhgn4J3C
         1iELBaqhbAMEZvHrLbYFDzqEz2J8JVawIB1R5ZHScveY3RmgASrjutdu2aOWFNN4YNIC
         v26Q==
X-Gm-Message-State: ALoCoQkQlLMzQi5D+B9FFEFVpBgUSVsUkrKGhnYHWuco2qyDZ4L96DstjXN7+niO211pn1sk1mmw
X-Received: by 10.43.65.1 with SMTP id xk1mr57208484icb.32.1430853310292;
        Tue, 05 May 2015 12:15:10 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.95.68 with SMTP id h62ls3145453qge.55.gmail; Tue, 05 May
 2015 12:15:09 -0700 (PDT)
X-Received: by 10.140.95.135 with SMTP id i7mr326621qge.27.1430853309531;
        Tue, 05 May 2015 12:15:09 -0700 (PDT)
In-Reply-To: <7b8abc94-1928-4f61-82c2-75711d0b7a50@isocpp.org>
X-Original-Sender: john.yates.sheets@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:17708
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/17708>

------=_Part_5275_1046166535.1430853308825
Content-Type: multipart/alternative; 
	boundary="----=_Part_5276_1472335756.1430853308825"

------=_Part_5276_1472335756.1430853308825
Content-Type: text/plain; charset=UTF-8

On Tuesday, May 5, 2015 at 12:37:02 PM UTC-4, Igor Baidiuk wrote:
>
> Frankly speaking, I don't see what should it solve.
>

Did you read the linked to proposal?
 

> If you know type statically, then you use template programming, static 
> constexpr members.
> If you don't know type statically, then you'll need to go through vtable 
> anyway to know exact type.
>

Correct, the type is _not_ statically known.  The first example in my 
document tries to be an illustrative example.  If you find it inadequate 
perhaps you could help me improve it.
 

> If this is a shortcut for 'virtual getSomeConstant', then please note that 
> constant should be allocated somewhere in vtable and be perfectly 
> constexpr. Not very flexible.
>

That is exactly the use case.  It is a way of accessing efficiently class 
"properties". 
 

> And BTW vtable structure is implementation-defined.
>

Yes, I am well aware of that point.  Once I have paid the price in an 
object to have a vtable pointer, retrieving a constant at a fixed offset is 
all I seek.  I am not trying to control layout of the vtable, only 
attempting to piggyback on the the fact that my object contains a pointer 
to a class-specific piece of initialized readonly  storageand perhaps 
suggesting how much storage is necessary to store my constant.

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_5276_1472335756.1430853308825
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, May 5, 2015 at 12:37:02 PM UTC-4, Igor Baidiuk=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Frankl=
y speaking, I don't see what should it solve.<br></div></blockquote><div><b=
r></div><div><span style=3D"font-family: arial, sans-serif; font-size: smal=
l;">Did you read the linked to proposal?</span></div><div>&nbsp;</div><bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">If you know type s=
tatically, then you use template programming, static constexpr members.<br>=
If you don't know type statically, then you'll need to go through vtable an=
yway to know exact type.<br></div></blockquote><div><br></div><div style=3D=
"font-family: arial, sans-serif; font-size: small;">Correct, the type is _n=
ot_ statically known. &nbsp;The first example in my document tries to be an=
 illustrative example. &nbsp;If you find it inadequate perhaps you could he=
lp me improve it.</div><div>&nbsp;</div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;"><div dir=3D"ltr">If this is a shortcut for 'virtual getSomeConsta=
nt', then please note that constant should be allocated somewhere in vtable=
 and be perfectly constexpr. Not very flexible.<br></div></blockquote><div>=
<br></div><div>That is exactly the use case. &nbsp;It is a way of accessing=
 efficiently class "properties".&nbsp;</div><div>&nbsp;</div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;"><div dir=3D"ltr">And BTW vtable structure is=
 implementation-defined.<br></div></blockquote><div><br></div><div>Yes, I a=
m well aware of that point. &nbsp;Once I have paid the price in an object t=
o have a vtable pointer, retrieving a constant at a fixed offset is all I s=
eek. &nbsp;I am not trying to control layout of the vtable, only attempting=
 to piggyback on the the fact that my object contains a pointer to a class-=
specific piece of initialized readonly &nbsp;storageand perhaps suggesting =
how much storage is necessary to store my constant.</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_5276_1472335756.1430853308825--
------=_Part_5275_1046166535.1430853308825--

.
