220 37567 <20180330054757.GA2396@noemi> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Magnus Fromreide <magfr@lysator.liu.se>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: add the metafunction scope
Date: Fri, 30 Mar 2018 07:47:57 +0200
Lines: 46
Approved: news@gmane.org
Message-ID: <20180330054757.GA2396@noemi>
References: <5e47cc81-4834-4a68-8925-717fb2ec8612@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1522388757 8300 195.159.176.226 (30 Mar 2018 05:45:57 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 30 Mar 2018 05:45:57 +0000 (UTC)
User-Agent: Mutt/1.9.2 (2017-12-15)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDELLREETMBRBEE767KQKGQEBI75WJQ@isocpp.org Fri Mar 30 07:45:53 2018
Return-path: <std-proposals+bncBDELLREETMBRBEE767KQKGQEBI75WJQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f71.google.com ([209.85.215.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDELLREETMBRBEE767KQKGQEBI75WJQ@isocpp.org>)
	id 1f1mrJ-00025a-DW
	for gclcip-std-proposals@m.gmane.org; Fri, 30 Mar 2018 07:45:53 +0200
Original-Received: by mail-lf0-f71.google.com with SMTP id x143-v6sf2410743lff.22
        for <gclcip-std-proposals@m.gmane.org>; Thu, 29 Mar 2018 22:48:01 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1522388881; cv=pass;
        d=google.com; s=arc-20160816;
        b=O3UOYcOjwPco4ODYAhP/KUUhsp9NP2xrpquJuo5eOAQtiIHWct9uodc+Z2m09spf38
         BjoV6TFfixRhxjEsysUPSGp8gjStzH5PoaiNOn7gczYJbDmJtVnijDLz7B/YLU2+iFMf
         W4Gz3IAlQmtaPVZUGmXwiWOPs9zqn0eiBLURyqHQAlFqN6dAeiixlynvIkyZjhIzB66p
         gx9ECLW4avcFJyX8uIdjE+cpGaUcr7lO8xrCboYwSpQhgrH9o+NINkTHK0h1ZqJ7FZBp
         xokVva7nR0swt1LMaeZ08vaX2WeqByqxgragB7MA4KH1fb4swifzNsinZ2wrdY/+ZlQx
         egSQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:user-agent:in-reply-to
         :content-disposition:mime-version:references:mail-followup-to
         :message-id:subject:to:from:date:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=ubNU1M9CizZO6oRO0onstl0qa8tILrqRkgXaJwaIkaE=;
        b=xnCwacws2OZc0IhDoVd6PkpgfPVJad2zMJxy3gW1qo0F/E4O6yX81C+qcdCScql62Q
         cHcTaWBuneU1BTWiFSkv2ZHxScVHwvZXoUxpnthg9UHGugzjHR2WsYfIOzn8HqaNS9s7
         VMNCP8nbaM7A/klXf7iPliWG12dN/0hIapNIIkNX/Q8LV0C4xGiWvN8esRHG3x/9nvWE
         RcMeD1V7pY/QZIt7QEDMjJjB3eijcjeRwPxeGRa+AWdC1xajERyP92nyaNzyKW7HvfJ7
         14y627hERD35sLFM96SjToJKOXrbXkakEYnFtXF/JtGfQdjXcN3ktvubaXYz0dqutTNa 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of magfr@lysator.liu.se designates 130.236.254.3 as permitted sender) smtp.mailfrom=magfr@lysator.liu.se
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:subject:message-id:mail-followup-to:references
         :mime-version:content-disposition:in-reply-to:user-agent
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=ubNU1M9CizZO6oRO0onstl0qa8tILrqRkgXaJwaIkaE=;
        b=US0u06sNDaq0NjhlIjYEbHbWq6vTbEy8MIa6WojLe/M2IaY9SafqXR0gLc71bxwYlF
         /wqWrfF3BtdWz0y/ErZv7Qb3iJoXr+AlCuTDrJ75WVpO5/N0QJEjEbrafy6/AJMAajuB
         qDxjH0LR4VjvpbsFubuxZF1Cx5gpqB80wjo1BoS6dYyvFkIiz6mlF0iPt7ul6zmuqGPp
         w383id091u1BRk4dEREPT2aNKTa4KhJiaGjDFAAQJo5BhF2itnmr6wfTnPQAcqMuAXFK
         211XGnitbQpDI+JxoUgyedwDHCc6kHUg5ynGekRN5ewqEQFKXqnIst4x5fnDMpQrySSu
         y6kg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to
         :references:mime-version:content-disposition:in-reply-to:user-agent
         :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=ubNU1M9CizZO6oRO0onstl0qa8tILrqRkgXaJwaIkaE=;
        b=MXNqIDY0+f4itwC0tnb9oKjZvHZ4ljewyoZ9ZI2AoHZ6P0cNFVzomWLppuNxoaQPgN
         hEFVysmlc4zrZ/deIcrFVR2lGQiuvh3qnF556iHI/H0yPLfxXBgdrIyY8BINSsTVWW9g
         0OpjppGHsFVdqCkPiMVLm4kY0G1A+nfmURP7ICE7QKi3r1HxbAi8S3ZjsI+fTh4+AhNa
         FrzAsD2uD4xjvQuY7qLsiR52jdfUVT0K7IohCDqhPfqVXDu6GBHAe6iJkL8UrDAL6jaq
         FEIRgEf7M/dhJb9gWJcVTCZhMxzeMtHfqNC+D9jWSbMLhBIylX86fgUHfXV 
X-Gm-Message-State: AElRT7FlX6JuZDPn+YONh+L/SIR8O5+6EXAerZSoWIK3avCKtUfTK0Ma
	+nJ3B9Fn7J4bd0A39JLVMgRkNA==
X-Google-Smtp-Source: AIpwx48EUxf28hqDXfGHQwa/muqAeQQQvze5GJirKoogDmR3K/TevhCbHvHoWLMreAS03CLzdwtlxQ==
X-Received: by 10.46.137.2 with SMTP id d2mr1628648lji.44.1522388881057;
        Thu, 29 Mar 2018 22:48:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.46.33.211 with SMTP id h80ls941838lji.13.gmail; Thu, 29 Mar
 2018 22:47:59 -0700 (PDT)
X-Received: by 10.46.29.140 with SMTP id w12mr7099289lje.108.1522388879422;
        Thu, 29 Mar 2018 22:47:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1522388879; cv=none;
        d=google.com; s=arc-20160816;
        b=nZixvbu5TIMxe+FJcdlDZRugxHqe6Y9YMcDsue4nIF1iMRR3fFgF36rsuOsqd51s5V
         rL7C2/NTv6BfXJkHMuvCHMlDXHVhFhPrtQqxLezHE7qM/etAmCOlb1ruPBZrH5EZaOd1
         TUMRwmXkjImMdVP3K/jCi90o2D3EtEmVBFkxnZYVqJsT4R3vVGdpslmn2RTgkWHjyU9O
         1cs8Fa3Ehr88ETWSC4ZdU5ZMbRePSVjPUImWv476wc/XfzRqN29J1iXPemtgz46DmIhK
         X31h6Ns+GCfjyWHXsWQieWyZjn3gl0S9FUe0bTpYF/bAUvptnKgXFCR4wHT5FfgumQQP
         Uf6w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=user-agent:in-reply-to:content-disposition:mime-version:references
         :mail-followup-to:message-id:subject:to:from:date
         :arc-authentication-results;
        bh=aHO63jTcQ1laYPMq2AXuYRBcg07fvYAIe1t9VcL+pYk=;
        b=TdZzWNDVJthJjLL0LQjke2UYljl8t3fKFa/F7SFSlMQHZ++DC8hH+fpgWqvXm6EB9u
         w427YOEibj9IV4wILhX/E7J4UoLX0Vw++uwMBnxvpeOR2MOB41vVqoxB6mQYuUcqf4gg
         LqZfSqYlRIibuYH4OHlvkO68nH198oCwmLzhw+/y0+fJaWnFBbr0/g2/JfIWEk3PTjsC
         m5+SqpcijthGcjOmxLdfVG/48OXQPffexRJvppCHUhS/it/FGck8t4HmhJvyv+T/M/EY
         wTq6wKv5KioDKZm1YWmjFlDjD9BBBcF6tsmpoAo16emEuyk7R7Tezfrir8xXAA/5gQje
         k3oA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of magfr@lysator.liu.se designates 130.236.254.3 as permitted sender) smtp.mailfrom=magfr@lysator.liu.se
Original-Received: from mail.lysator.liu.se (mail.lysator.liu.se. [130.236.254.3])
        by mx.google.com with ESMTPS id z10-v6si2893838lfj.196.2018.03.29.22.47.59
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
        Thu, 29 Mar 2018 22:47:59 -0700 (PDT)
Received-SPF: pass (google.com: domain of magfr@lysator.liu.se designates 130.236.254.3 as permitted sender) client-ip=130.236.254.3;
Original-Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id D3B144001E
	for <std-proposals@isocpp.org>; Fri, 30 Mar 2018 07:47:58 +0200 (CEST)
Original-Received: from noemi (user172.77-105-211.netatonce.net [77.105.211.172])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id B06AA4000D
	for <std-proposals@isocpp.org>; Fri, 30 Mar 2018 07:47:58 +0200 (CEST)
Mail-Followup-To: std-proposals@isocpp.org
Content-Disposition: inline
In-Reply-To: <5e47cc81-4834-4a68-8925-717fb2ec8612@isocpp.org>
X-Virus-Scanned: ClamAV using ClamSMTP
X-Original-Sender: magfr@lysator.liu.se
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of magfr@lysator.liu.se designates 130.236.254.3 as permitted sender) smtp.mailfrom=magfr@lysator.liu.se
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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:37567
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37567>

On Thu, Mar 29, 2018 at 07:01:03PM -0700, liweifriends@gmail.com wrote:
> 
> For a program that heavily depends on compile time calculation, this might 
> be a serious problem, since the compiler might store a lot of such 
> "useless" information during compile, this will increase the memory useage 
> of the compiler and slow down the compile procedure.
> 
> To solve this problem, I think we should introduce an "metafunction" scope, 
> as follows:
> 
> metafunction
> {
> template <typename T>
> struct RemoveConstReference
> {
>     using tmp = typename std::remove_const<T>::type;
>     using type = typename std::remove_reference<tmp>::type;
> };
> }
> 
> using ResType = typename RemoveConstReference<const int&>::type;

Your example does not make any sense.

Ain't RemoveConstReference out of scope at the point of "using ResType"?

> the RemoveConstReference is included inside this scope, so after the 
> calculation of ResType, the compiler might remove all the information 
> generated inside this scope. This will save the memory of the compiler and 
> speed up the compile procedure.

If, on the other hand you put "using ResType" before the closing brace of
the metafunction clause then ResType would become undefined right after it's
definition and that also is unusable.

As a final thoght this sounds a lot like a namespace with an unutterable name,
how does your metafunction compare to a namespace?

/MF

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/20180330054757.GA2396%40noemi.

.
