220 5308 <CAEn_SP+jA2r6OjupsbkBDQpuPxZTJP-HFtBp-XBasf+LuA8psA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Martinho Fernandes <martinho.fernandes@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Overloaded Declarators
Date: Sat, 6 Jul 2013 03:03:37 +0200
Lines: 131
Approved: news@gmane.org
Message-ID: <CAEn_SP+jA2r6OjupsbkBDQpuPxZTJP-HFtBp-XBasf+LuA8psA@mail.gmail.com>
References: <82b89c5e-ce4e-49c0-82b2-d6032631e3e3@isocpp.org>
	<CAEn_SP+DOsLN5NezjN-OvPoDfiyMEWYzXBzKhjJ88NB_-TnyOw@mail.gmail.com>
	<6ed86280-bff9-4dc5-bef3-28be8981770b@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1373072619 27915 80.91.229.3 (6 Jul 2013 01:03:39 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 6 Jul 2013 01:03:39 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDXL3FEUYQARB2OZ3WHAKGQETGXNARA@isocpp.org Sat Jul 06 03:03:41 2013
Return-path: <std-proposals+bncBDXL3FEUYQARB2OZ3WHAKGQETGXNARA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qa0-f70.google.com ([209.85.216.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDXL3FEUYQARB2OZ3WHAKGQETGXNARA@isocpp.org>)
	id 1UvGuZ-0003hN-Fl
	for gclcip-std-proposals@m.gmane.org; Sat, 06 Jul 2013 03:03:39 +0200
Original-Received: by mail-qa0-f70.google.com with SMTP id cr7sf3390635qab.5
        for <gclcip-std-proposals@m.gmane.org>; Fri, 05 Jul 2013 18:03:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-beenthere:mime-version:in-reply-to:references:date:message-id
         :subject:from:to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type:content-transfer-encoding;
        bh=neDjWtyQ6ekk5RZNZaLolLcrYk8mlOSdlG4spgn+RjA=;
        b=oUtJcBvL5G7YJJpU8z7XNEFOIjHXPRDzW5FAYgpcnjnwW4syFN55kERmSQOwZsxBkK
         Uwv4UJAXAupoI9k6RjT1WlU6p0vOzMn5wR0b582rQy1dZ0uTjk97EXLs0ZZbECrPrgU2
         mxWjIle9n3xsrg4xv1zJjAcAOul7rRAJFgJR/Dy0R4dglbucWFJpK59hM7nG+vfTqLQr
         NB786v5VFc+TO6AwGyZ/o/4pJuVVysBvrgS+lxay5aXNueMDz6XPISBnsNrq43bobMMT
         2XuzFFOkbwO9y00HpAyzuSZwj9xVb1HaFKnV7RPt5K3TPLligL1B3GKJINY0dQhgMrTI
         PmdQ==
X-Received: by 10.224.205.138 with SMTP id fq10mr14870375qab.1.1373072618461;
        Fri, 05 Jul 2013 18:03:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.49.226 with SMTP id x2ls1106984qen.12.gmail; Fri, 05 Jul
 2013 18:03:37 -0700 (PDT)
X-Received: by 10.49.127.196 with SMTP id ni4mr7436883qeb.5.1373072617662;
        Fri, 05 Jul 2013 18:03:37 -0700 (PDT)
Original-Received: from mail-qc0-x22a.google.com (mail-qc0-x22a.google.com [2607:f8b0:400d:c01::22a])
        by mx.google.com with ESMTPS id o5si2865682qag.187.2013.07.05.18.03.37
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 05 Jul 2013 18:03:37 -0700 (PDT)
Received-SPF: pass (google.com: domain of martinho.fernandes@gmail.com designates 2607:f8b0:400d:c01::22a as permitted sender) client-ip=2607:f8b0:400d:c01::22a;
Original-Received: by mail-qc0-f170.google.com with SMTP id s1so1510327qcw.1
        for <std-proposals@isocpp.org>; Fri, 05 Jul 2013 18:03:37 -0700 (PDT)
X-Received: by 10.49.74.227 with SMTP id x3mr7168869qev.29.1373072617560; Fri,
 05 Jul 2013 18:03:37 -0700 (PDT)
Original-Received: by 10.49.94.238 with HTTP; Fri, 5 Jul 2013 18:03:37 -0700 (PDT)
In-Reply-To: <6ed86280-bff9-4dc5-bef3-28be8981770b@isocpp.org>
X-Original-Sender: martinho.fernandes@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of martinho.fernandes@gmail.com designates 2607:f8b0:400d:c01::22a as
 permitted sender) smtp.mail=martinho.fernandes@gmail.com;       dkim=pass header.i=@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: <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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:5308
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/5308>

There is a big problem in that the existing code that wants pointers
uses T*, not std::pointerto<T>. And that's a rather *large* body of
code.
Mit freundlichen Gr=FC=DFen,

Martinho


On Sat, Jul 6, 2013 at 1:05 AM,  <andrewtomazos@gmail.com> wrote:
>> What if I want an actual pointer now?
>
> Suppose you overload unary operator& on a class:
>
>     struct X
>     {
>         Y operator&();
>     }
>
> What if I want the actual address of an object of type X now?  You use
> std::addressof.
>
> In a similar fashion alias templates could be provided in the standard
> library, for example std::pointerto<T>, such that even if the * declarato=
r
> was overloaded for that class, pointerto<T> would always give you the typ=
e
> "pointer to T":
>     -Andrew.
>
>
> On Friday, July 5, 2013 3:57:23 PM UTC+2, R. Martinho Fernandes wrote:
>>
>> What if I want an actual pointer now?
>> Mit freundlichen Gr=FC=DFen,
>>
>> Martinho
>>
>>
>> On Fri, Jul 5, 2013 at 8:32 AM,  <andrew...@gmail.com> wrote:
>> > If we view for a moment the various parts of a declarator as operation=
s
>> > on
>> > types:
>> >
>> >     T*: T -> pointer-to-T
>> >     T&: T -> lvalue-reference-to-T
>> >     T&&: T -> rvalue-reference-to-T
>> >     T[]: T -> array-of-T
>> >     T(): T -> function-returning-T
>> >     and so forth
>> >
>> > These operations take one or more types as input and produce a type as
>> > output.
>> >
>> > This is not dissimilar to an alias template:
>> >
>> >    template<class T>
>> >    using MakePointer =3D T*;
>> >
>> >    template<class T>
>> >    using MakeReference =3D T&;
>> >
>> > In fact we could almost say that functions are to the built-in
>> > expression
>> > operators, as alias templates are to the built-in declarators.
>> >
>> > So the proposed feature "Overloaded Declarators" is to enable a
>> > user-defined
>> > alias template to redefine the built-in meaning of a declarator.
>> >
>> > Overloaded Declarators are to the built-in declarators, as Overloaded
>> > Operators are to the built-in expression operators:
>> >
>> >    struct Foo{}
>> >
>> >    template<class T>
>> >    using operator*<Foo> =3D shared_ptr<T>;
>> >
>> >    Foo* p;  // p has type shared_ptr<T>
>> >
>> > The above shows a key use case, specializing the declarator `T*` to
>> > designate a user-defined smart pointer class instead of pointer-to-T f=
or
>> > some set of types.
>> >
>> > Just a random idea.
>> >
>> > Enjoy,
>> > Andrew.
>> >
>> > --
>> >
>> > ---
>> > 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-proposal...@isocpp.org.
>> > To post to this group, send email to std-pr...@isocpp.org.
>> > Visit this group at
>> > http://groups.google.com/a/isocpp.org/group/std-proposals/.
>> >
>> >
>
> --
>
> ---
> 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/.
>
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.



.
