220 18783 <CAFk2RUZYc+Cxm8qDrhSd7Pg2fkEeOtStM=pytuM3wgJs8w6NiA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: std::vector - adding support for non-moveable,
 non-default constructible types with lambdas
Date: Thu, 25 Jun 2015 19:12:26 +0300
Lines: 36
Approved: news@gmane.org
Message-ID: <CAFk2RUZYc+Cxm8qDrhSd7Pg2fkEeOtStM=pytuM3wgJs8w6NiA@mail.gmail.com>
References: <06317928-6af2-4133-a38e-8d6c829f311b@isocpp.org>
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 1435248755 19937 80.91.229.3 (25 Jun 2015 16:12:35 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 25 Jun 2015 16:12:35 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5JHI7A7ALRB2WQWCWAKGQE66LC42I@isocpp.org Thu Jun 25 18:12:31 2015
Return-path: <std-proposals+bncBC5JHI7A7ALRB2WQWCWAKGQE66LC42I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ig0-f197.google.com ([209.85.213.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRB2WQWCWAKGQE66LC42I@isocpp.org>)
	id 1Z89lM-0007Gm-C2
	for gclcip-std-proposals@m.gmane.org; Thu, 25 Jun 2015 18:12:28 +0200
Original-Received: by igczg2 with SMTP id zg2sf137532783igc.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 25 Jun 2015 09:12:27 -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:in-reply-to:references: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=N3bO6mXyaTqqL9SCN4ZYOSQO3mtob9SEWECWPIZqm9U=;
        b=DiOdyHVUzMth/ClAqGa0BTvzGeBj3pJ4gh1AzO02+MCke6MrGErcnboWINRIaR6+NC
         n1y8FELiAgmZlkxaAGrVSWLFEQMvTWqyw9Eik9DvskFoD8FW2sUqrVQl/7IByAFL1Oie
         9grM+0VI1lmgVpTq7wxPvHhsL9Toom6Y3X1tQYNkYjJZSZKKbCyKiGVmh329K30dGSUy
         sjivQYUZD6IgQJgAW06+bY64qW1lFqizSo51uvb3Ilnsd3Qwu9770fsOR2pJ8yU+Ryef
         us+0Y03d/kIZm6aPbxbVh6BoqzU/puev6L0779+QpUY08brIZrREXGkyBZoZ+Z3jNQtm
         EIQw==
X-Gm-Message-State: ALoCoQkUxmuN4rwH9Nu6kPxCHpDaNwcJ776ENxjXewQB16GoFTHKOi61p03nKG92VjstQ/faPrWS
X-Received: by 10.50.128.40 with SMTP id nl8mr4697113igb.4.1435248747284;
        Thu, 25 Jun 2015 09:12:27 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.129.65 with SMTP id nu1ls998564igb.40.gmail; Thu, 25 Jun
 2015 09:12:26 -0700 (PDT)
X-Received: by 10.107.9.150 with SMTP id 22mr42864396ioj.39.1435248746251;
        Thu, 25 Jun 2015 09:12:26 -0700 (PDT)
Original-Received: from mail-ie0-x22e.google.com (mail-ie0-x22e.google.com. [2607:f8b0:4001:c03::22e])
        by mx.google.com with ESMTPS id xd13si19982637icb.36.2015.06.25.09.12.26
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 25 Jun 2015 09:12:26 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:4001:c03::22e as permitted sender) client-ip=2607:f8b0:4001:c03::22e;
Original-Received: by iebrt9 with SMTP id rt9so57838523ieb.2
        for <std-proposals@isocpp.org>; Thu, 25 Jun 2015 09:12:26 -0700 (PDT)
X-Received: by 10.43.8.4 with SMTP id oq4mr42857584icb.64.1435248746112; Thu,
 25 Jun 2015 09:12:26 -0700 (PDT)
Original-Received: by 10.36.152.7 with HTTP; Thu, 25 Jun 2015 09:12:26 -0700 (PDT)
In-Reply-To: <06317928-6af2-4133-a38e-8d6c829f311b@isocpp.org>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of ville.voutilainen@gmail.com designates 2607:f8b0:4001:c03::22e as
 permitted sender) smtp.mail=ville.voutilainen@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.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>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:18783
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18783>

On 25 June 2015 at 19:06, Matthew Fioravante <fmatthew5876@gmail.com> wrote:
> If you have a type T that has deleted move/copy operations and you want to
> store objects of this type in a vector you are forced to default construct
> the elements use the vector<T>::vector(size_t) constructor. After this you
> can naturally not push_back(), insert(), reserve(), etc.. as all of those
> operations may require moves.
>
> If we want to call a different constructor, or we don't have a default
> constructor for T we are out of luck and cannot use vector.
>
> We need to modify the behavior inside of vector's constructor to customize
> which constructor for T is actually called. The way to do this is with
> functional programming, that is we pass in a lambda to the vector
> constructor telling it how to construct each element.
>
> I presented an idea similar to this in a different thread for another array
> type, but I think this idea could be applied to vector.

This might be useful background:
http://cplusplus.github.io/LWG/lwg-defects.html#704

At one time, Gabriel Dos Reis discussed relaxing some of the type requirements
for vector, but I don't think either of us were able to materialize
that discussion into
a proposal. Both of us are fairly busy, so I cannot promise that
either will be able
to provide much assistance. Gabriel might have good suggestions. Maybe.

-- 

--- 
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/.

.
