220 19711 <2301060.qH0H7yDpJ1@tjmaciei-mobl4> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: rtti: missing sizeof() and alignof() in std::type_info
Date: Thu, 06 Aug 2015 16:43:31 -0700
Lines: 34
Approved: news@gmane.org
Message-ID: <2301060.qH0H7yDpJ1@tjmaciei-mobl4>
References: <3718ba80-d410-4cca-8e15-5113450281cc@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1438904637 29276 80.91.229.3 (6 Aug 2015 23:43:57 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 6 Aug 2015 23:43:57 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBJ7CR6XAKGQERDOIFCQ@isocpp.org Fri Aug 07 01:43:37 2015
Return-path: <std-proposals+bncBCB4TK757YBRBJ7CR6XAKGQERDOIFCQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f70.google.com ([209.85.215.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRBJ7CR6XAKGQERDOIFCQ@isocpp.org>)
	id 1ZNUoz-0007Kl-4w
	for gclcip-std-proposals@m.gmane.org; Fri, 07 Aug 2015 01:43:37 +0200
Original-Received: by labth1 with SMTP id th1sf33292135lab.2
        for <gclcip-std-proposals@m.gmane.org>; Thu, 06 Aug 2015 16:43:36 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=aSBnm+WxtmblK0Q7BTVvMfJ2+jRZBLeYo+okosfkoXI=;
        b=aqrUFGe0pJbH3InmALUb8aQBBOb/h10tDgSc1QiyWvkZM7wMXObrTnIPkcoBXvNwi1
         HqBVX/ntblgT3qrQXLnhf5U+clKsqIUMLN50jQ8Xz0AngFsnE3wxPL314qRgRlsInMsg
         4myFB04uM+OAyajyF69Yk4JdIT5LqX9t+iOA1Sunaqgd9jPTvSRrDw85xYN/5Nyf7Ff3
         dTUnPy/y+7CW4h/PwpAH6TFRdM7wrfwFpW40jLROsrZimW87ci3A7dm8s0AbOvaDuPYK
         auNbZwYCaorVfdNxlfHFa4T9YbaAGrKhpc17U2ZVSw9r9xjLPXxNhgNSGOmpCMPoKJhm
         DQTg= 
X-Gm-Message-State: ALoCoQmgnG0gBB0SyIPfOa7RohREwwH+g72VwSIzYX+xuMZSY5KAJPXR2fS2pTEoSn+NeYsQ0HBG
X-Received: by 10.152.182.226 with SMTP id eh2mr1235348lac.0.1438904616398;
        Thu, 06 Aug 2015 16:43:36 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.106.100 with SMTP id gt4ls231242wib.6.canary; Thu, 06 Aug
 2015 16:43:35 -0700 (PDT)
X-Received: by 10.180.74.52 with SMTP id q20mr147556wiv.94.1438904615030;
        Thu, 06 Aug 2015 16:43:35 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id g7si16019206wjy.213.2015.08.06.16.43.34
        for <std-proposals@isocpp.org>;
        Thu, 06 Aug 2015 16:43:34 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl4.localnet (unknown [134.134.139.76])
	by gondolin.macieira.info (Postfix) with ESMTPSA id B2E5D11BA03
	for <std-proposals@isocpp.org>; Thu,  6 Aug 2015 16:43:33 -0700 (PDT)
User-Agent: KMail/4.14.9 (Linux/4.1.3-1-desktop; KDE/4.14.9; x86_64; ; )
In-Reply-To: <3718ba80-d410-4cca-8e15-5113450281cc@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mail=thiago@macieira.org
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:19711
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19711>

On Thursday 06 August 2015 13:42:57 Matthew Fioravante wrote:
> Is there any reason that sizeof(T) and alignof(T) are not available via the 
> type_info struct from typeid()?
> 
> I want to use the address and size in particular to create a mapping of 
> objects within other objects for debugging purposes. It doesn't actually 
> appear to be possible in C++14 to get the size of the most dynamic type 
> without rolling your own rtti solution.
> 
> What I would suggest is adding size() and align() methods to type_info to 
> return sizeof(T) and alignof(T) respectively.

Sounds like a reasonable proposal, but one tricky to implement.

In order to support polymorphic types linked before this feature, it needs to 
support returning sizeOf() == alignOf() == 0 or another sentinel value that 
indicates absence of information. 

Also note that typeid(void) is valid, so what does typeid(void).sizeOf() 
return?
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

-- 

--- 
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/.

.
