220 34041 <a3ad5bed-1f56-bdb7-d020-5361be8c186c@otoy.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ross Smith <ross.smith@otoy.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: std::vector<T, Alloc>::expand_uninitialized
Date: Tue, 22 Aug 2017 14:09:44 +1200
Lines: 45
Approved: news@gmane.org
Message-ID: <a3ad5bed-1f56-bdb7-d020-5361be8c186c@otoy.com>
References: <405bc3a4-4fbf-41af-b213-b24894ba2f6e@isocpp.org>
 <0304ee31-d873-25a5-1ff9-3364e76dff67@gmail.com>
 <CAKiZDp151PprK6Q_Gajnyh0URotphRK98M154jjPQEjAUOkX4Q@mail.gmail.com>
 <38511f1a-5d75-4c95-a240-89e19a03bbe6@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
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1503367786 20686 195.159.176.226 (22 Aug 2017 02:09:46 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 22 Aug 2017 02:09:46 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.3.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCQ4ZXOXM4IONJHOZQCRUBHMO4RAQ@isocpp.org Tue Aug 22 04:09:37 2017
Return-path: <std-proposals+bncBCQ4ZXOXM4IONJHOZQCRUBHMO4RAQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk0-f198.google.com ([209.85.220.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCQ4ZXOXM4IONJHOZQCRUBHMO4RAQ@isocpp.org>)
	id 1djydM-0004pC-Rw
	for gclcip-std-proposals@m.gmane.org; Tue, 22 Aug 2017 04:09:36 +0200
Original-Received: by mail-qk0-f198.google.com with SMTP id u63sf32593610qkb.3
        for <gclcip-std-proposals@m.gmane.org>; Mon, 21 Aug 2017 19:09:43 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1503367783; cv=pass;
        d=google.com; s=arc-20160816;
        b=XrYlVvNdwg0v/4938PLbr1QW5+1straB1qz3cppIeMkXL0TTLmGJRitJq5VsdYV747
         OTpc+0Tt7VqWV9wrsXpBKNjwSIw6WomE2ylC9hLkOlsy8Aql1N+It1dbwdbiVUw51q2v
         93pmSrZZEBFH/tim4vhmgLvMtmNBiRj9ugTuFUWn0zJTseVStNxkeQMzeh0ZRQ62ynlf
         +AYh9jQdzYoVIqhPFwrztgT45NELqQRet3+nK60RcoEIKX3F6NScmEpVachWaamL5e4n
         wntKZR0knlHNk2fQSa84duLuYS2/jzAjAp1wqIqxiG/vIhBiiVngOkyT1PysdCQ3W3Tu
         +/EA==
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-transfer-encoding
         :content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:newsgroups:to:subject
         :arc-authentication-results:arc-message-signature:dkim-signature
         :arc-authentication-results;
        bh=SjYgXBGoNRzdoBt7qIkNo43TR6tb8r6XNQppnfJlXC8=;
        b=KYav40aFvb4fQK9rcQAAiJRhqxJrysWHxGqPDZsx0U8Rda2FuAM7yTxcOzjPZqhW5x
         udpJwhKH7f8eSB+ZF+1zLDkLIjJPYIuKDBTuExoo70kZ/5vdQIW0KL6Leez5QvMyXEZe
         HfgON6iWusiZIIJ31AjUcYe/gfAPkYu3+FUpW98e8XbvojSdEs6OQ2jl2uA5m9KPjbUk
         J8EmnRZa7utuJ8lXraEN2GUeNTbNjqUsIaNUe1cji7b/squyScVf9bfei8uuJwWO+PSo
         Jy4S+TTyitMBlpw468rscqLicJytobzmB+MS4pfFH 
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@otoy-com.20150623.gappssmtp.com header.s=20150623 header.b=z9lyBedE;
       spf=pass (google.com: domain of ross.smith@otoy.com designates 2607:f8b0:400e:c00::233 as permitted sender) smtp.mailfrom=ross.smith@otoy.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:newsgroups:references:from:message-id:date:user-agent
         :mime-version:in-reply-to:content-language:content-transfer-encoding
         :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=SjYgXBGoNRzdoBt7qIkNo43TR6tb8r6XNQppnfJlXC8=;
        b=D2hx3z6WyLg//WLoF19xbiPrvAWhq3sDu211600ion8k6SI09rs4w+257OAPseNbrj
         THoKexLuuVjlM7Vtpvq7zH7KXAqWP50zM7HpgqvYJmhyxDcaqffEaTa+nOFwM0lG3+WG
         k1qZNsjwr2dQvG63xvBq1O1WU5tIQ6j0YPvl4IBoMexxUwNASIf5fTnzR9N0hOHMXW7z
         x2/kBprQZM81SZEnkyQSrrSuDt3JRv7zwa5vktULmXmksSbWbvkfCGnWSitRkAF7Ol+k
         /2nXkpP2rYOI0yzOJr62ZYdQX1Khk4WXaTWeErdJ+DSpP1iVbdo+mOWBV1muPrKZiXEZ
  
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:newsgroups:references:from:message-id
         :date:user-agent:mime-version:in-reply-to:content-language
         :content-transfer-encoding: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=SjYgXBGoNRzdoBt7qIkNo43TR6tb8r6XNQppnfJlXC8=;
        b=aQTc/bUpBAKM8nt0M3A8Xm2jr1g1UaPlGfNXtnjvOvh1hDYCKfCgMy+tIgoS0mzTru
         EZ0OdT3Ao6RV7CDva237+45Md4uo3PmMST0cVHHs1Bq12jsUpSyrs1XF5BPHS6mp5VCt
         N9hVzUXc1FPsg49IA5JIjFY7SLNButkJLFxruwDe7CPIMh259UJaucNDdE5tAWpJmmJ7
         GToDpYb5l0XoNewmzyn+6Y3+1ANK59IHXZ9ldI4J6oqLzAFuH6VnshQAczqn9NlwDAhB
         U4uJUme0CLY8jGHAEfTKQO7i7hBvquwP 
X-Gm-Message-State: AHYfb5imjd+R5VFy3S9vqN5nA71XzsWsTy4V6SL+D80+zX8ffyfKEpam
	3kvagFHvXtFhtiBe
X-Received: by 10.237.56.231 with SMTP id k94mr5444795qte.3.1503367783431;
        Mon, 21 Aug 2017 19:09:43 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.23.70 with SMTP id 67ls9987535iox.18.gmail; Mon, 21 Aug
 2017 19:09:42 -0700 (PDT)
X-Received: by 10.84.128.106 with SMTP id 97mr21148179pla.41.1503367782117;
        Mon, 21 Aug 2017 19:09:42 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1503367782; cv=none;
        d=google.com; s=arc-20160816;
        b=T1wWQw2Twd6kkc4cQDk0zTG+pQVUXL33GbuoGuIwgDbYIsXFIpg7RHCe9eLeiXwkuw
         khVz1js6nePkmgHVKolRwiINNGnsVkxbGm0msZE3hQfqqM6hCEZ0CRD1HYFAj4AiCth8
         E3Q8BL8/jAqsjrNmhzI/2DOEShPjDoFdmEf0oFiL/xzKqnSfs+K7XSI/EZR1RUHCwSAb
         79J+LgibUQAiJyV3YrxXnmfU6yiYYkq1ko6vFoH/xdnupGfAD5Y/fLk/skgK55k0moZz
         cCUzDYOcMfw5/dKqTEQAlXZ7K9tnEfTv2MsFy+EEZ4wbHuBF95OtUv3meyo+rTe+IQC6
         xUGw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:newsgroups:to:subject
         :dkim-signature:arc-authentication-results;
        bh=2Ut2VSfUycswNJzawXpLvQxwVhwCUikyfBYFUD7x6ok=;
        b=aruROKlcIMnoCBpE7R7CXka0osqqxm1T59WcDSopGL6sq++lp6L03vF2z3NhPqRSAK
         pS4es+fAP+Oo4gifn0nXi7kH6j7fTGyGB5d5rElt+kGSC2MvD46jcsD+X9CC287PXmxV
         BdPlngpFZeieGiJYrczmLZ4oDKPfBn7NmeBUHZ/xAWodOobz5G6qC5+CDmE6sfeInAdD
         3s65H0PWR3JgnZuUOwCfL/m7WPfJOxRojtRIXSbZTK2yuy2j5oKDRyl5E68bmsRfepl9
         0J4mv5gq55KeGyejTNbO/d8HMDHLzxijbp/xpOGDG3Izz56NqVqYiFTrcADad+QLvOjg
         a9EQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@otoy-com.20150623.gappssmtp.com header.s=20150623 header.b=z9lyBedE;
       spf=pass (google.com: domain of ross.smith@otoy.com designates 2607:f8b0:400e:c00::233 as permitted sender) smtp.mailfrom=ross.smith@otoy.com
Original-Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com. [2607:f8b0:400e:c00::233])
        by mx.google.com with ESMTPS id c64si1581911pfl.530.2017.08.21.19.09.42
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 21 Aug 2017 19:09:42 -0700 (PDT)
Received-SPF: pass (google.com: domain of ross.smith@otoy.com designates 2607:f8b0:400e:c00::233 as permitted sender) client-ip=2607:f8b0:400e:c00::233;
Original-Received: by mail-pf0-x233.google.com with SMTP id h75so4965596pfh.1
        for <std-proposals@isocpp.org>; Mon, 21 Aug 2017 19:09:42 -0700 (PDT)
X-Received: by 10.84.215.210 with SMTP id g18mr21526667plj.210.1503367781662;
        Mon, 21 Aug 2017 19:09:41 -0700 (PDT)
Original-Received: from [10.0.0.87] (125-236-198-58.adsl.xtra.co.nz. [125.236.198.58])
        by smtp.gmail.com with ESMTPSA id o18sm11512995pgd.51.2017.08.21.19.09.39
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 21 Aug 2017 19:09:41 -0700 (PDT)
Original-Newsgroups: gmane.comp.lang.c++.isocpp.proposals
In-Reply-To: <38511f1a-5d75-4c95-a240-89e19a03bbe6@isocpp.org>
Content-Language: en-US
X-Original-Sender: ross.smith@otoy.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@otoy-com.20150623.gappssmtp.com header.s=20150623
 header.b=z9lyBedE;       spf=pass (google.com: domain of ross.smith@otoy.com
 designates 2607:f8b0:400e:c00::233 as permitted sender) smtp.mailfrom=ross.smith@otoy.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: <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:34041
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34041>

On 2017-08-22 13:46, Nicol Bolas wrote:
>=20
>=20
> On Monday, August 21, 2017 at 9:19:46 PM UTC-4, Patrice Roy wrote:
>=20
>     +1. Really looks like a reserve() use-case to me.
>=20
>     2017-08-21 4:29 GMT-04:00 Jonathan M=C3=BCller <jonathanm...@gmail.co=
m
>     <javascript:>>:
>=20
>         On 20.08.2017 22:22, Ryan Nicholl wrote:
>=20
>             My motivating example consists of a serialization routine.
>             Ideally, the serialization routine would expand the vector
>             uninitialized and then write the data in. This can't be done
>             however, because the resize function writes 0s to the data
>             thanks to the default allocator's construct method.
>=20
>=20
>         Could you clarify why reserve + push_back() doesn't work here?
>=20
>=20
> I expect it's the reason he stated: he wants to prevent the value=20
> initialization of the object, since he's going to initialize it from the=
=20
> serialization routine. He wants to avoid the double-initialization.
>=20
> Again, that's a reason to allow default initialization, not to do what=20
> he suggests.

Isn't that why we have emplace_back()?

Ross Smith


--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/a3ad5bed-1f56-bdb7-d020-5361be8c186c%40otoy.com.

.
