220 33686 <omctnb$6nf$1@blaine.gmane.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Bo Persson <bop@gmb.dk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: string_view for fstream::open()
Date: Tue, 8 Aug 2017 19:51:47 +0200
Lines: 47
Approved: news@gmane.org
Message-ID: <omctnb$6nf$1@blaine.gmane.org>
References: <cb7b55ab-7113-4d99-949b-8568627d0b7f@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
X-Trace: blaine.gmane.org 1502214721 9968 195.159.176.226 (8 Aug 2017 17:52:01 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 8 Aug 2017 17:52:01 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.2.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCZ6RLW3UIKBBP7UU7GAKGQEZ76IZRI@isocpp.org Tue Aug 08 19:51:56 2017
Return-path: <std-proposals+bncBCZ6RLW3UIKBBP7UU7GAKGQEZ76IZRI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f70.google.com ([74.125.82.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCZ6RLW3UIKBBP7UU7GAKGQEZ76IZRI@isocpp.org>)
	id 1df8fb-0002Iv-Mu
	for gclcip-std-proposals@m.gmane.org; Tue, 08 Aug 2017 19:51:55 +0200
Original-Received: by mail-wm0-f70.google.com with SMTP id i187sf5445533wma.15
        for <gclcip-std-proposals@m.gmane.org>; Tue, 08 Aug 2017 10:52:02 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1502214722; cv=pass;
        d=google.com; s=arc-20160816;
        b=xekkdrH5zIifCyk7dGX7BKvhcvGHKA0dAJ4YYY1+Y0wlOc9dMnOyyosNidA48k4ncK
         wbmnishep0tUvcE+D+ZggWHdWnuVXbP1JJ87cMaB7J3Kz0lLbJ10scTYuAFDjvTopNjh
         2T32ec8yOf9narGwEByETd7xEqxCoNihxizWJVrmajFXoichbTWiq/4tJ6w8G9q4f1Qh
         0Iz2uUY64Crr6ie1FByD/4wlIHTFxt4Rqtei92oL/TSg+36JEerHuuZkwMNsFdQwJCHj
         nue7MAQIwT5GsMbD2TO09CrgdkrN7/qFToz5hz0L+CxaE/g397jZ97Q1Z1rt49Bw2NO2
         hCXA==
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-language
         :in-reply-to:user-agent:mime-version:references:message-id:lines
         :date:subject:from:to:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=LkB1ejvG06VFyKXZFJ6QERrNGgvzcha7e7PxsB7KTKc=;
        b=bxIY+Mljjd86ByBx5X1X8/gjh/asl+ZnA9sDy0HBMIyjdEft7XWcmVmimLUWgu6t6T
         TPg6VWF8Vu7d/V73boAZskHLzctQwxSdtFo+G0dYtTARLbsezQkwZNMQBfDpcCoUmwk6
         5ms7+hdRAiHvhQUz2cPw8Nofos1V/GBXP12rIu74/ieozcjOHll+ppXtZTL/dxF+Cu52
         lZS1+YSTAnbrVpguBD2dp/K7UzoZspuHdoRBP4htokyKkpMF9kBdTLmsIa9s8sxXkKoC
         /Gf9dzLuXCM1JEvuZKGCwwNpBYKvBdp8Ot38bKc//4+qkaiNwOk/PpLUowjPsmtwYAtg
         sLjQ 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :user-agent:in-reply-to:content-language: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=LkB1ejvG06VFyKXZFJ6QERrNGgvzcha7e7PxsB7KTKc=;
        b=mjYnd+8Edx4kyyYR8txGA425CPzzsjRCY0S2p2dZJHl1BAmSidgRynEFgUu7l6TcOX
         eLEaTVVi19dT3XAenqinTJkrlX0LC3eLds1lUAlqq9SL3RZTTJyfXjnRK7OCOUm3Do1C
         xL0qsLnlFjdbj1AbBjn+4bUhTYgcoS5Rh0g6NeTtVFeOmEnEmI96ZlXJrUcUH+k9lgLN
         +ZbYJJKq5S6wSJuQcCNFAqcQPZlJ5H+/DDLS1x/INGGqJ/mS2gkiGIr7PAF4hJWbaB0+
         hzSsJhGeCz1hjcaybIdhkkYIqYXtsTR+77qeVGZV0NH5QQ4c0WAsSY4oKrfq3LJbDTB2
         IxTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-to:content-language
         :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=LkB1ejvG06VFyKXZFJ6QERrNGgvzcha7e7PxsB7KTKc=;
        b=YS7dGXHvFiV9PqooREnASROshGBTXfl1r6wjxCch2HKN3UkjgNJi04YVf97McakQYh
         0kq15H7hseVq1ZVw/wwWR4x+v7pfEeUp7MasF/SxwNAyAC1pRyvSRGrURl4Jz5ko+Hkm
         6sWJik8xgVW49ax9qWHfpU2JhvmhwghBdvUHrv0LmYQ3Nktb/S9SiIlW9Rp9DTnnm4T1
         lLeG8U+SpqeIBgRC037gyvNk0bIzO8LzDpC55kIeMX3neCD+QmkHnGpSxdz3rEpwU7Jb
         hlNndK+tqcbppKhVo3b6vAbtKL6gETFJHhvk+1k3keQahr1ZfoV35cfPK1gt7VbIXi00
     
X-Gm-Message-State: AHYfb5gj/Hn3/Wr7KaPGe26TytFgefxP0QkhM5S+KvOW1jTXFKx7eLIn
	v87o0tkcTangfA==
X-Received: by 10.28.11.144 with SMTP id 138mr723706wml.23.1502214722036;
        Tue, 08 Aug 2017 10:52:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.25.206.68 with SMTP id e65ls319492lfg.13.gmail; Tue, 08 Aug
 2017 10:51:59 -0700 (PDT)
X-Received: by 10.46.87.81 with SMTP id r17mr1980353ljd.188.1502214719424;
        Tue, 08 Aug 2017 10:51:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1502214719; cv=none;
        d=google.com; s=arc-20160816;
        b=uYOzeZFrLnDcrfL/Htbz4mx/ks5RPEPDHSSRDPRNQk3+IvMlGC0lyXIxmYjlPv9fXy
         sPbvxveJxZHcJxXQbxJy1AcGm6EOrHeoS31D3DTgwQuALSKBcGNsq5LVMiHOMtEvKPRZ
         e0Ba0Eqy8q9+CE85kuX8Xli3LODQRzagtTEPuz3MmebMuttGWkByU4YPCESEc64Y2Chh
         R+eJsZyQrFjjE7YAfpdp6q+bUMdyg/zxZJgrpW+60gKUPOggBVQwZ0XtdmVsZVkfSqxU
         maNNbuqTOSX+t3sEmcMkoSPqXY+AQt4NpNuUTlR3+dwaJCFDRdsfnJq2mDLyh0Q+T1N/
         8k6g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:in-reply-to:user-agent:content-transfer-encoding
         :mime-version:references:message-id:lines:date:subject:from:to
         :arc-authentication-results;
        bh=kVzyWz+//l4dpIaDPwbZp5wLyIEHTYumu9nzV0Vty1w=;
        b=jDEpCClG0cz/JiMQpYHjQktLu/j4h+6Lm0t3Fm53wluL9S2y46cb+3eK6afZVund+7
         aIOXVBqk4EeRKlZF+1A0tLct4YzbFgjpbp0bRvt4zv/8KmWU4ngJf1RsyeVnmtmzT+iF
         xXpHnXTNob0gcYFuczie2jBkDb5mJ3E+hR7RBWj+wGqO5Roa1s8CmCVAMLfuU9sLujc/
         td+jcXGtyFQnDKOe3dlX8Dy4XKemkvr9GaCWFZf36PEPCaopWa7yH5N0lQOr/ULcaExy
         bKrZxbB1WzwlmSJc7xtGTVvnVvIGmiddu5XR+nNurM0cdvBu4XkgRCNcOFLJzlU6LuUe
         FdVQ==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id 25si799324ljc.405.2017.08.08.10.51.59
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 08 Aug 2017 10:51:59 -0700 (PDT)
Received-SPF: neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) client-ip=195.159.176.226;
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1df8fX-00026y-85
	for std-proposals@isocpp.org; Tue, 08 Aug 2017 19:51:51 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 40
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <cb7b55ab-7113-4d99-949b-8568627d0b7f@isocpp.org>
Content-Language: sv
X-Original-Sender: gclcip-std-proposals@m.gmane.org
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 195.159.176.226 is neither permitted nor denied by best guess
 record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
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:33686
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33686>

On 2017-08-08 19:46, Julian Watzinger wrote:
> I'd like to propose a simple addition to std::basic_fstream:
> 
> Currently, there's two overloads for std::basic_fstream::open.
> 
> |
> voidopen(constchar*filename,
>      ios_base::openmodemode =ios_base::in|ios_base::out);
> 	
> 	
> 
> 	
> 	
> voidopen(conststd::string 
> <http://de.cppreference.com/w/cpp/string/basic_string>&filename,
>      ios_base::openmodemode =ios_base::in|ios_base::out);
> 
> |
> 
> That means that when making extensive use of string_view, I'd have to 
> create a temporary std::string to open a filestream in a safe way. I 
> suggest adding a third overload:
> 
> |
> voidopen(conststd::string 
> <http://de.cppreference.com/w/cpp/string/basic_string>_view &filename,
>      ios_base::openmodemode =ios_base::in|ios_base::out);
> |
> 
> plus an addition overload for this in the constructor. It would require 
> the same addition to std::basic_filebuf::open. From what I can tell, it 
> looks feasable. Any objections/further suggestions?
> 

One objection is that the file name is supposed to be a nul-terminated 
string. The string_view is not required to be that.


     Bo Persson


-- 
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/omctnb%246nf%241%40blaine.gmane.org.

.
