220 19960 <CANu6V4X2rw7+U5puUghGLW1oHx5RGYvTg6KwqaJszXCuA=SBqA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: "'Johannes Schaub' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: A non-owning smart pointer?
Date: Sat, 22 Aug 2015 16:49:05 +0200
Lines: 32
Approved: news@gmane.org
Message-ID: <CANu6V4X2rw7+U5puUghGLW1oHx5RGYvTg6KwqaJszXCuA=SBqA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1440254948 16333 80.91.229.3 (22 Aug 2015 14:49:08 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 22 Aug 2015 14:49:08 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCQPNCEZSQNBBYMX4KXAKGQEQFLCJGY@isocpp.org Sat Aug 22 16:49:07 2015
Return-path: <std-proposals+bncBCQPNCEZSQNBBYMX4KXAKGQEQFLCJGY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCQPNCEZSQNBBYMX4KXAKGQEQFLCJGY@isocpp.org>)
	id 1ZTA6V-00006u-1f
	for gclcip-std-proposals@m.gmane.org; Sat, 22 Aug 2015 16:49:07 +0200
Original-Received: by iofe124 with SMTP id e124sf176092407iof.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 22 Aug 2015 07:49:06 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:date:message-id:subject:from:to
         :content-type: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=LvebvcwwqjNfqjj1DFN0VmRlKyO/JB0zRsR7JIYGXu0=;
        b=Ret3cCb/Hfz69Fix3g4fGXMlmz3woTY2zITTpEXdfEpc2v1Nl5wHa3AHRXBX3D4QY9
         Co93hPq7QMFTL1R9j3UYC8ZKIhSPvQXFB8F1u6TEyxTGdODQKh8fCwdaAs1IAOsPEOOr
         2CTYpLJAzAEQseqfUCLAmyYZYDWUyAQufkIp3h7rwwEhef4e0m7TedW1bpdVqha4wHD4
         FIQvVEJ2rWpI1ZKBEM3kXIwo/pc+X7MJC6QXML//D6l7Tga8J7asH2Na1jNw8WHwowoF
         yS3Iba0qVUE75D26QeQa0viz7Qnh7/tFW7aTYTo2aaWD3HD8exO414V+w4vIZuFIUEui
         yB9Q==
X-Gm-Message-State: ALoCoQkgu4MzjR36ZnSMsdP/NFv/sCUmGXhPBrd4JCJR5lV9mBRUulZ8W9oaDar7qgHZXcLHltf1
X-Received: by 10.50.17.10 with SMTP id k10mr8262933igd.8.1440254946149;
        Sat, 22 Aug 2015 07:49:06 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.130.193 with SMTP id m62ls1045379ioi.33.gmail; Sat, 22 Aug
 2015 07:49:05 -0700 (PDT)
X-Received: by 10.50.111.230 with SMTP id il6mr7416589igb.56.1440254945416;
        Sat, 22 Aug 2015 07:49:05 -0700 (PDT)
Original-Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com. [2607:f8b0:4001:c06::22f])
        by mx.google.com with ESMTPS id sd4si3957606igb.67.2015.08.22.07.49.05
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 22 Aug 2015 07:49:05 -0700 (PDT)
Received-SPF: pass (google.com: domain of schaub.johannes@googlemail.com designates 2607:f8b0:4001:c06::22f as permitted sender) client-ip=2607:f8b0:4001:c06::22f;
Original-Received: by iodv127 with SMTP id v127so109083281iod.3
        for <std-proposals@isocpp.org>; Sat, 22 Aug 2015 07:49:05 -0700 (PDT)
X-Received: by 10.107.136.69 with SMTP id k66mr9080882iod.111.1440254945067;
 Sat, 22 Aug 2015 07:49:05 -0700 (PDT)
Original-Received: by 10.79.81.199 with HTTP; Sat, 22 Aug 2015 07:49:05 -0700 (PDT)
X-Original-Sender: schaub.johannes@googlemail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of schaub.johannes@googlemail.com designates 2607:f8b0:4001:c06::22f
 as permitted sender) smtp.mailfrom=schaub.johannes@googlemail.com;
       dkim=pass header.i=@googlemail.com;       dmarc=pass (p=QUARANTINE
 dis=NONE) header.from=googlemail.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: <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>
X-Original-From: Johannes Schaub <schaub.johannes@googlemail.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19960
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19960>

Hello all,

I would like to have an explicit non-owning smart pointer, like "T*",
but that is required to check in "->" and "*" that the pointer is
non-null (alternative implementations like checking on construction
and assignments are welcome!)

This would stop people that want to programm defensively from having
to check their argument pointers from being null or from transforming
their parameters to references (just because they don't expect null
pointers? Um, we should have a more direct way to do this and still be
able to operate on pointers!).

template<typename T>
struct raw_ptr {
   T *operator->() const {
      .... throw if ptr== 0
   }

   T &operator*() {
      ... throw if ptr == 0
   }
};

-- 

--- 
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/.

.
