220 18934 <88bd4cab-a13d-41ef-813c-e931c0b95226@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Edward Catmur <ed@catmur.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Unified coercion protocol: static_cast explicit overload
Date: Thu, 2 Jul 2015 03:38:09 -0700 (PDT)
Lines: 94
Approved: news@gmane.org
Message-ID: <88bd4cab-a13d-41ef-813c-e931c0b95226@isocpp.org>
References: <5c654bc3-5294-4f8a-bf1a-bf4a9f6c8603@isocpp.org>
 <CAKiZDp2p=a2c+vt6bo47vR=f=QU-UqPiuFCV6eUPrhkRjXYyLw@mail.gmail.com>
 <ef10545e-db46-44f6-aaac-f70bf739c6ba@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_216_1050109078.1435833489443"
X-Trace: ger.gmane.org 1435833493 25793 80.91.229.3 (2 Jul 2015 10:38:13 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 2 Jul 2015 10:38:13 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDZLZTXF7UJBBEVJ2SWAKGQELZBB4VY@isocpp.org Thu Jul 02 12:38:13 2015
Return-path: <std-proposals+bncBDZLZTXF7UJBBEVJ2SWAKGQELZBB4VY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f197.google.com ([209.85.192.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDZLZTXF7UJBBEVJ2SWAKGQELZBB4VY@isocpp.org>)
	id 1ZAbsi-0007Zt-Fl
	for gclcip-std-proposals@m.gmane.org; Thu, 02 Jul 2015 12:38:12 +0200
Original-Received: by pdzq9 with SMTP id q9sf159047188pdz.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 02 Jul 2015 03:38:11 -0700 (PDT)
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:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=DgapF7VfdAR9cTPOr/JI4s78ULXcaQ43BZ6HH4JEBFk=;
        b=FEDYpe5sQzFjFiN9HF2AeqcJefmP4uGaMN8gOpHrpz6EvlQZos6SIeZfW4OWRWL6QA
         qsa8zQ4KuDkfV165kHmnO1+ZRzgPst+EfzG/dE1KJCg+2DfZq+VSdvDIlgMlybu3mbhl
         vMzpZZHSwoYit1kYCqx6rMIDTfTd0suv3J4iErFhV+MsuewbFCyJLBH4MtPv3pu3s3jF
         TXFc41MVymMaKgMODtjHoSMEiWCXLCnvZ0VW+747ALySZyPfsdMQRrV3rb1DOqBciVgP
         fyrp2jfhwCjLatBjPD7eAsgZ9UhidL+1LrVtHTtXYd/dV8cNn1s3h7IqfeHX4sIUFtBr
         N5VQ==
X-Gm-Message-State: ALoCoQl2Xoi9Mr/dkSPrMXmUEedNFpTrg18IOPYu5g3jz3UlfHwKqvQUsc6sVpyRf+Usp9RkG80F
X-Received: by 10.67.6.196 with SMTP id cw4mr39942544pad.46.1435833491514;
        Thu, 02 Jul 2015 03:38:11 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.16.173 with SMTP id 42ls1225420qgb.47.gmail; Thu, 02 Jul
 2015 03:38:10 -0700 (PDT)
X-Received: by 10.140.94.166 with SMTP id g35mr160259qge.1.1435833490011;
        Thu, 02 Jul 2015 03:38:10 -0700 (PDT)
In-Reply-To: <ef10545e-db46-44f6-aaac-f70bf739c6ba@isocpp.org>
X-Original-Sender: ed@catmur.co.uk
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:18934
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18934>

------=_Part_216_1050109078.1435833489443
Content-Type: multipart/alternative; 
	boundary="----=_Part_217_1162662900.1435833489443"

------=_Part_217_1162662900.1435833489443
Content-Type: text/plain; charset=UTF-8

On Wednesday, 1 July 2015 14:55:52 UTC+1, Igor Baidiuk wrote:
>
> I cannot define conversions as free-standing functions.
> Sometimes it's really useful when you want those conversions, but don't 
> want to pollute struct interface, because those conversions are used only 
> inside of some module.
>

Also when defining vocabulary type interoperations; I might have a Date 
type that I want to be able to convert to/from Boost.Gregorian, but I don't 
want to impose a dependency on clients that don't need the interop.

The easiest way to write this would be to allow non-member conversion 
functions:

explicit operator To(From const& from) { ... }

I think this was raised in passing here last year, although without much 
result: https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/CmBERU_sr8Y

-- 

--- 
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_217_1162662900.1435833489443
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, 1 July 2015 14:55:52 UTC+1, Igor Baidiuk  wr=
ote:<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">I cannot =
define conversions as free-standing functions.<br>Sometimes it's really use=
ful when you want those conversions, but don't want to pollute struct inter=
face, because those conversions are used only inside of some module.<br></d=
iv></blockquote><div><br></div><div>Also when defining vocabulary type inte=
roperations; I might have a Date type that I want to be able to convert to/=
from Boost.Gregorian, but I don't want to impose a dependency on clients th=
at don't need the interop.</div><div><br></div><div>The easiest way to writ=
e this would be to allow non-member conversion functions:</div><div><br></d=
iv><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187)=
; word-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">explicit</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">operator</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">To</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #606;" class=3D"styled-by-prettify">From</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">from</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><div=
><br></div><div>I think this was raised in passing here last year, although=
 without much result:&nbsp;https://groups.google.com/a/isocpp.org/forum/#!t=
opic/std-proposals/CmBERU_sr8Y</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_217_1162662900.1435833489443--
------=_Part_216_1050109078.1435833489443--

.
