220 41385 <a97e361c-772e-6fb5-5ca8-d72250f45541@gmail.com> article
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Andrey Semashev <andrey.semashev@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Improving compile times for non-template
 dependent member functions.
Date: Wed, 23 Jan 2019 19:11:49 +0300
Approved: news@gmane.org
Message-ID: <a97e361c-772e-6fb5-5ca8-d72250f45541@gmail.com>
References: <6a72db2a-932d-4f79-ab68-7c1424e93b9d@isocpp.org>
Reply-To: std-proposals@isocpp.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="2321"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.0.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCXY5TXHWYJRBSNEULRAKGQEY6C2Z2Y@isocpp.org Wed Jan 23 17:17:06 2019
Return-path: <std-proposals+bncBCXY5TXHWYJRBSNEULRAKGQEY6C2Z2Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lj1-f198.google.com ([209.85.208.198])
	by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
	(Exim 4.89)
	(envelope-from <std-proposals+bncBCXY5TXHWYJRBSNEULRAKGQEY6C2Z2Y@isocpp.org>)
	id 1gmL86-0001bF-Ia
	for gclcip-std-proposals@m.gmane.org; Wed, 23 Jan 2019 17:11:54 +0100
Original-Received: by mail-lj1-f198.google.com with SMTP id v27-v6sf791865ljv.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 23 Jan 2019 08:11:54 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1548259914; cv=pass;
        d=google.com; s=arc-20160816;
        b=CUas8R5bbQLeFG/V7kQXAbWC705AyWhRvdytDyAHJ6bmdg/EchzwondeVXR0vOUJ+r
         LldRCSuGMzO79a1WyMYvDlL4MPw5JGN3U/tGBmjvzXMNRgefL8QrC/VV6pfv7nJDTSeq
         9k9yE++SbOV1N/EpvWRw/ltf+3LE1HlKuS8On1KWY8zsZ9vYPNBPEPqlGNz9rgoKHSpb
         rjxyLXqHQB2kleqPsLkryv6d0cYZkkBiErTXWv0ThLZriQ+Zz7OjBHPka+C4JJnVRFGr
         GfrfQwI0aksRogL9rpJ/PbabPWPLfLhakhk1daf95HYPmoKWQEkgf0XrYNJYypw+98Wi
         PuvQ==
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:content-transfer-encoding
         :content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:dkim-signature;
        bh=QBZQk+nuUIyGlBdwqcKJaF1qIxJAGFfXnBDnXbAlOo8=;
        b=brkOlVWfkbhLeauv4dBX3eC29h6DfZbLwldzrWwJxXZqBBOzMXvcDgshhZShoyjnRw
         RYr5ZEy38Z3VIzKTtuyKeSBsYD3+cjS0A260G3jcpwrsAMhkD2GRkaMwJAjDTxeCi8fH
         UnBNeS6ETA+XLx8vuHxo1SBqQmvwAD202j1kQ4UBa3bi6wddlkfwN+EKjm2EHGdWRvDi
         CKwomzD4M13UdX3mLER0hbaf85t5nXHjNqiOmdbU/bgFURSDvTiH0000GcgMAx2VL8DG
         Z/hsIk58ULQjefjnp/FiieW4AwV0tyfMt4Ao0iK4kyls2AdeddG4KTPKUKCkXhKIEuQV
         w0zQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=G0tioA29;
       spf=pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:content-transfer-encoding
         :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=QBZQk+nuUIyGlBdwqcKJaF1qIxJAGFfXnBDnXbAlOo8=;
        b=QwBAxpKuvAIG1V0eHkOVWvjnSs2FkxrlPWytQy7gAhBDK/xZgSCB5Ju2lTj45q2iSp
         FgDKvcsq/c8gUMVb3x7PRP8TGm9Bhy1jx69uQBKyPB98lS7ok/yCnxTTkJwTtl9OEduA
         Qhv/lKI01brNQXAkyUlbZrbg8KOkfRsBe7xfYgvpc4LDvCdzX9j0UM58ZAQu6rhrBUHy
         uoBvbwsMavsfnsrWdKjtJPimq0EsUSjDMP13k6OM/ghSoGJR3bwuTltrWIjQmZxZ+dOC
         dnPTwCFY6BkjmnHo6EPjFDB42rHTWhKkB/zEwVTF8CVoSLoOVb/FJTpemD0hlQB5nmue
         2wU 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :content-transfer-encoding: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=QBZQk+nuUIyGlBdwqcKJaF1qIxJAGFfXnBDnXbAlOo8=;
        b=WEDxXXEvqJaDB/U1E9WFeRSJjQhjMkZrwmHMmv2asXpLmtm6X0knIi1C3+duwffOkj
         yQoeW0SuGeDxt6+1GjhFPexyaqIOEfVnu0CVSMlWFpcjKGGQIQff04G/yMEdFp48fT5e
         PeciRr4Sbhbbg5MEoCH+AfSHeQfAKrgcpKNdL82K0jlcCTtO5d/2IovqNfFgIypzhagj
         /f6GQjQggP7OVwRpNmfZIVqxFXeK9JiRQ6uhbH++zoX6Y54hzzR1vaGxzQyrJkcjXR9B
         4q7ehZfstSgIrsI10zBOdH4JgCGgj67hv/ZbZbbnL2n 
X-Gm-Message-State: AJcUukevnta5+ty/NRH5lYFXPr5V1sNNpufHE5azAkXPfnWTudWx3dF5
	mGWHSLygUjL8JPzjkExAjMmVng==
X-Google-Smtp-Source: ALg8bN6O0aibBIyZrDSpo2KmAEnpZHSV+nX5APxRsMO+ZkQGQViDybHO7cn6wSdhXX+7lwTbUasqxg==
X-Received: by 2002:a19:c952:: with SMTP id z79mr246762lff.14.1548259914038;
        Wed, 23 Jan 2019 08:11:54 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a19:f65:: with SMTP id e98ls299016lfi.4.gmail; Wed, 23 Jan
 2019 08:11:52 -0800 (PST)
X-Received: by 2002:ac2:51af:: with SMTP id f15mr2319691lfk.44.1548259912074;
        Wed, 23 Jan 2019 08:11:52 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548259912; cv=none;
        d=google.com; s=arc-20160816;
        b=ppCzEeehAPkcoShb5siJv7dSzLPcPnCXyUO8POxiJuDYAZw+zwNo04/D6Sd/Eb6UvQ
         /WmA3yGEImblPiyfptVKeDhvRS6qk/ZLeg8NSCSlxUOHUDtsNYmEl7s5WmYboyWEBxnk
         OKvXds5bJwaKVvCjZXDDAEm+0r1DlaVyByBChJVXpr7MSGTKTTWx/+a+HJNBhDx11hYq
         4MxrHwHYra3ud7WiAdXVDvGQeLGzs7OU1VXzJmjJEA/RntjdM6oWxqPU/P4O7mARH84+
         clEA8ZJ9U6/gIfN9fv/1xYgxx2y0oNdaiiGF4Dijp/jhBg1bCJ+wYsNJ50YuzYzvGGKl
         Rzlg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:to:subject
         :dkim-signature;
        bh=t7lQgtsTNSaUhZomhVP2JwrixT+g08FEoapLs/zQm30=;
        b=Tj9CB4oDEMXAXyOEw8YpfmkrSN9znDuHQEi6p46SJwNBfZvHLSV4HYf9ezzuOP6QIc
         SgR097ZUNiea8ZUJ/0P08wLDQeuo/93ymUAT8kxkO1jmwrr32vZZgwqJKJ6G/u3EUFjz
         3ZZC7NAyonV+g7o7F6Ty/stcDZEYGi/f228z2HrZMWG4CV0wnaK+B28w1Zvw63LlZKGk
         wpd8T4r/V8ELGqoThv/yeAg+QTQB07jDa14wlCjFJTBsTJ3v1YfPuyaVD6wrUfXa/oMA
         Hyc9QysWaLUnlJepnHAGr/8tS0nNtJnodF44xZHAjhDhquppKu4B+l18pC/TWITIqw4k
         2PeQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=G0tioA29;
       spf=pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id f10sor1178408lfm.1.2019.01.23.08.11.52
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Wed, 23 Jan 2019 08:11:52 -0800 (PST)
Received-SPF: pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:ac2:51a2:: with SMTP id f2mr2249743lfk.161.1548259911296;
        Wed, 23 Jan 2019 08:11:51 -0800 (PST)
Original-Received: from [192.168.1.2] (broadband-37-110-31-10.ip.moscow.rt.ru. [37.110.31.10])
        by smtp.googlemail.com with ESMTPSA id j12-v6sm573888ljh.66.2019.01.23.08.11.50
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 23 Jan 2019 08:11:50 -0800 (PST)
In-Reply-To: <6a72db2a-932d-4f79-ab68-7c1424e93b9d@isocpp.org>
Content-Language: ru
X-Original-Sender: andrey.semashev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=G0tioA29;       spf=pass
 (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE dis=NONE) header.from=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: <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:41385
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/41385>

On 1/23/19 6:58 PM, p groarke wrote:
> I'll take a wild guess this has already been asked, thought-of or=20
> written about, but lets ask anyways. I'm curious why one cannot write=20
> the implementation of non-template dependent member function in a=20
> compile unit, in the hopes of improving compile times.
>=20
> For example :
>=20
> .h
>=20
> |
> template<classT>
> structtest {
> intval()const;
>=20
> private:
> intval {42};
>  =C2=A0 =C2=A0 T t;
> };
> |
>=20
>=20
> .cpp
>=20
> |
> // I do not depend on T, can implement in compile unit.
> // Declaration semantics unimportant.
> inttest::val()const{
> returnval;
> }
> |
>=20
>=20
> I remember a cppcon talk from Ubisoft, where they bypass this issue by=20
> inheriting a base class with non-template dependent behavior implemented=
=20
> in their compile unit. Template dependent behavior is implemented in the=
=20
> header of the derived class.
> Why not offer this compilation behavior out-of-the-box?

I assume, the main reason is that because the method is not instantiated=20
until it is ODR-used (e.g. called). This is a useful property, which, in=20
fact, may improve compile times if the method body causes a lot of other=20
template instantiations or expensive code generation.

--=20
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 e=
mail 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/a97e361c-772e-6fb5-5ca8-d72250f45541%40gmail.com=
..

.
