220 38916 <CAC+0CCMRC5JHx4N2JFzN960xfYsBVfKVt=7iSN5NCws3ALHkFA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Jake Arkinstall <jake.arkinstall@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allow forward class declarations to match a type alias.
Date: Fri, 29 Jun 2018 23:45:09 +0100
Lines: 76
Approved: news@gmane.org
Message-ID: <CAC+0CCMRC5JHx4N2JFzN960xfYsBVfKVt=7iSN5NCws3ALHkFA@mail.gmail.com>
References: <b2fb570b-aadb-423e-9821-025cb447cf60@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="000000000000442a5e056fcf9a12"
X-Trace: blaine.gmane.org 1530312198 13430 195.159.176.226 (29 Jun 2018 22:43:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 29 Jun 2018 22:43:18 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDCZX3WUUQFRBAPN3LMQKGQEGDB33PI@isocpp.org Sat Jun 30 00:43:14 2018
Return-path: <std-proposals+bncBDCZX3WUUQFRBAPN3LMQKGQEGDB33PI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-it0-f71.google.com ([209.85.214.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDCZX3WUUQFRBAPN3LMQKGQEGDB33PI@isocpp.org>)
	id 1fZ26h-0003MC-E4
	for gclcip-std-proposals@m.gmane.org; Sat, 30 Jun 2018 00:43:12 +0200
Original-Received: by mail-it0-f71.google.com with SMTP id k85-v6sf2843545ita.0
        for <gclcip-std-proposals@m.gmane.org>; Fri, 29 Jun 2018 15:45:22 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1530312322; cv=pass;
        d=google.com; s=arc-20160816;
        b=jsjTZVLX+p0P6MhJzkHFYWDgJC0jv1uqlZ8uZfeacdlWSaUJ+w82teG1Phx17xpMYZ
         B5jGfrGLkRfFIlfesw4XsONDJR1NXTRS3O/v/2slb9kesDtpKV/nLMc45BlDhWCRm5l+
         zw2zOZZL89T9oGQyU/n737KPWAh7h86dcI+VkQ4Sum1cAmBH3adK20o5UZohG+n4G5zz
         JOOJgkDxDHZ+XhdQXEY449Hsb255Ckdu5W7ErQ9xKxxeOSmROPSe4fbGst7ipTDObhm4
         U1SgAV1pB7oZ8GsW/Gk0KRwpd7B8ES/E11Le6y5uFOeuO3Xsa6JLMMs+2c37ka2nm0FD
         0apA==
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:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=kzdHHbTOQ6U7hG2qftyHBUFRmW/LD1VuypE3vR7YkwE=;
        b=AtOqh+KMndyEM0qEhw66XCVOmt9IclFIQDZOsDzfe5DLfwCauOt5ozIj8t8TIFpxIm
         OGHQ9DYcYeMxCKerDyVMyN13c5rk7sBBn03LoAe4s7Z4+j1GHviqs58IlT/PPds+ZSPw
         XvBeJvQBmPuw/KiaobqC9Y18WIoqlWLyv6GoHVS/Eq+iLnrJ5VRG26G80HRBlTsvHdKU
         sqpXBCNc3gNRPS2OmBvKoKUehwxS/mLwKqng4ptNZ2+wnbgd7iQXaYoyVvcBCpe8NIO2
         5diL7aCHQS5DuMKcqCmryEpM5gGbTsILSu5HRYTTzZlJFHTTogZiw9CDcp3VlHKorBtV
         c/2A==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=NjFzeNEC;
       spf=pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jake.arkinstall@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=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :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=kzdHHbTOQ6U7hG2qftyHBUFRmW/LD1VuypE3vR7YkwE=;
        b=io731HTa9opk8oMsZ+KeQ65+45sGDHfOpAbpplDOMbywNloo3AvuZXtgbjSs8lUnoY
         Zdh4YGDdXELi6B/I4b1oAFBNzwnHfdKogtJ4uejsAMbI0Rdrd3EAeRWqH+wRn1uja/Wc
         GfMcYDI8iUVOeO4YRbXAIQ/6crtPMTXkMPz0QPtFZJm/Nb9Q4gu6E2sMqU0dhHRq1mGA
         5AwI0gct73m7VvzIA5uM/1TDa3u5nR/ZwpDQ7BBcCS07uGtOsBCF4y7qXn66Is8Sfsxq
         U55HoNpu7dk30gwuqodwahV+Lsh23inOFzbv4YRVDAgAV+u/NA+MpNw6zv5EIQ6RBPz2
         BAVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to: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=kzdHHbTOQ6U7hG2qftyHBUFRmW/LD1VuypE3vR7YkwE=;
        b=VLRZxUZFZhRquuC/TTSEOZzLekycK9qvD493JCxN3sZ61zcPOo91MGVpYbFeurUIPS
         6W/x4w6YokP1qWoMITNBAJBJoKQjAwci0mk5X5xxYs5XdBRN5RKXGBifI8oZG1AJSHi9
         imKXSGs62P/IeWVJ0upvwXGFbJf3fy9lmFKZ2kod2j+4RGVzHMAjRI4nqiqtzAbiVvqw
         fwx4gTccej6WOLroU+cB3TLACX38p2ZEx2vdO1NdXYp1j/JWnPDkkkQ67xZ0XXzwdCUL
         WEB+FsdKOKXYW95eb37CnFAMfMg9mtpiC0RCYPlt9ZBo+6xW6EIOLjQ2UM3pkrQLuLzn
         EK+w==
X-Gm-Message-State: APt69E1QZKm0cjOa4YggnmbPRz7nh27y8PIahUPogY40/g6DlPEhPUik
	mmu+hYc9+535vTvLzy3M3xbcNA==
X-Google-Smtp-Source: AAOMgpeko1OgdVFcaxt0iALPOmlYvfdmNy1biu1Kjm7aqBq6/8ho+A96l9Y0ERT0VXKlK96ax9c1Pw==
X-Received: by 2002:a02:2244:: with SMTP id o65-v6mr6565145jao.56.1530312322262;
        Fri, 29 Jun 2018 15:45:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a6b:6a09:: with SMTP id x9-v6ls1704514iog.1.gmail; Fri, 29
 Jun 2018 15:45:21 -0700 (PDT)
X-Received: by 2002:a6b:d30e:: with SMTP id s14-v6mr13217033iob.213.1530312321103;
        Fri, 29 Jun 2018 15:45:21 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1530312321; cv=none;
        d=google.com; s=arc-20160816;
        b=D+mrnrLcVX3FyqZ1hfHuoy/iYNbPVOvBKYP+GHCVb+gY0Tyz5C9goaWlVwhUwFM0hu
         9DKgqbxn4mNmwRSPwtswaJGSounibeIWHZvwZO3J1et+Je/ueeCP93NoYOmkHeCebVaA
         L6XswIavlzBw/3xDjvHRKF55G+gOCt/s7xHQjro2AF680yZmuz1/glhggn9mC4aV3ucY
         hVazhceevEPiKRThyKE5PMEweIsPM1M8t9hWkxK2Rtyl1Ax6bSuzdnPdDhd2etu0/oQt
         a34CeyUugwjBwfzpufsBT6511/zUAPMN25iWdN3w0ez9KZ6AZayl3eUMVLiL+vfZ8lIj
         2VBA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=vXhmUG8OibCd01n/fpU4ynY/1XKXyhVk85yZYBWTGAM=;
        b=pHQM7nYUIVpJtlUCqRYY+IY0DCuklJoZw3/vUQGO0XXcjSvWF/brKnQZVrNKhr8TT5
         Zd93NiErSeM8tADAL2deKQ+8lV4pNLGc4ZgTgWMzqlMPzEKiqzf1P5r7Nnmiw4bqnm1p
         +iVNmRSnG6Q8VgjNCWFvUfRUHKCbCyJPeq1lAeU0M1sX5AZacbTzqkbEljtCIMm9l+lc
         APssxnxXwjQgDS08ydu8Wf0Vkiasy7ObfQdffv2/Shn2owAGGYnf0r6fhmHLg7mL8kZx
         Ww82ynwwiW19bru9EkDXhZ8CcqA22QkQFYSNVdJhkqGXC4boCJj20dtqZlJg2DMWXrTz
         e9Mw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=NjFzeNEC;
       spf=pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jake.arkinstall@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 68-v6sor3863302ion.18.2018.06.29.15.45.21
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 29 Jun 2018 15:45:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a6b:910a:: with SMTP id t10-v6mr14220200iod.59.1530312320623;
 Fri, 29 Jun 2018 15:45:20 -0700 (PDT)
In-Reply-To: <b2fb570b-aadb-423e-9821-025cb447cf60@isocpp.org>
X-Original-Sender: jake.arkinstall@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=NjFzeNEC;       spf=pass
 (google.com: domain of jake.arkinstall@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=jake.arkinstall@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-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:38916
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38916>

--000000000000442a5e056fcf9a12
Content-Type: text/plain; charset="UTF-8"

I had a similar refactoring once, and I approached it as follows. It might
not apply, But as this does seem like an XY problem to me I thought it best
to provide a potential solution.

The real problem is that you have code that depends on a class that doesn't
exist yet. Templates are your friend here. When you need to use FloatImage,
provide it as a template parameter. You then get the upshot of being able
to use your code with something other than a FloatImage in the future.

You can also give CudaImage a "using value_type = T". That way any class
which currently uses FloatImage can be given a template parameter T (which
in your current code would be provided with FloatImage) can accept
arguments of e.g. "typename T::value_type", and you aren't necessarily
locked into using floats as arguments if someone comes along and wants a
DoubleImage or something. If you want to restrict the types, concepts come
to the rescue.

If you have an API to preserve, rename the old classes and functions as
necessary, and expose the FloatImage-specialised versions under the
original names. If this doesn't sound like a convincing approach, the Eigen
library is a beautiful example (I'm not sure whether it is the result of a
refactor or of some brilliant foresight).

-- 
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/CAC%2B0CCMRC5JHx4N2JFzN960xfYsBVfKVt%3D7iSN5NCws3ALHkFA%40mail.gmail.com.

--000000000000442a5e056fcf9a12
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><div class=3D"gmail_quote"><div dir=3D"ltr">I had a =
similar refactoring once, and I approached it as follows. It might not appl=
y, But as this does seem like an XY problem to me I thought it best to prov=
ide a potential solution.</div><div dir=3D"ltr"><br></div><div dir=3D"ltr">=
The real problem is that you have code that depends on a class that doesn&#=
39;t exist yet. Templates are your friend here. When you need to use FloatI=
mage, provide it as a template parameter. You then get the upshot of being =
able to use your code with something other than a FloatImage in the future.=
</div></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">You can als=
o give CudaImage a &quot;using value_type =3D T&quot;. That way any class w=
hich currently uses FloatImage can be given a template parameter T (which i=
n your current code would be provided with FloatImage) can accept arguments=
 of e.g. &quot;typename T::value_type&quot;, and you aren&#39;t necessarily=
 locked into using floats as arguments if someone comes along and wants a D=
oubleImage or something. If you want to restrict the types, concepts come t=
o the rescue.</div><div dir=3D"auto"><br></div><div dir=3D"auto">If you hav=
e an API to preserve, rename the old classes and functions as necessary, an=
d expose the FloatImage-specialised versions under the original names. If t=
his doesn&#39;t sound like a convincing approach, the Eigen library is a be=
autiful example (I&#39;m not sure whether it is the result of a refactor or=
 of some brilliant foresight).</div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCMRC5JHx4N2JFzN960xfYsBVfKVt%=
3D7iSN5NCws3ALHkFA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCMRC5=
JHx4N2JFzN960xfYsBVfKVt%3D7iSN5NCws3ALHkFA%40mail.gmail.com</a>.<br />

--000000000000442a5e056fcf9a12--

.
