220 8354 <52C50E45.2000800@knejp.de> article
Path: news.gmane.org!not-for-mail
From: Miroslav Knejp <miro@knejp.de>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Obtaining a non-const iterators from a
 const_iterator and a non-const reference to the container
Date: Thu, 02 Jan 2014 07:59:17 +0100
Lines: 21
Approved: news@gmane.org
Message-ID: <52C50E45.2000800@knejp.de>
References: <68deff4f-5f1d-440e-b6cd-1e5077a3ff96@isocpp.org> <a0ca8331-96b9-4161-b715-f6a780221d85@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; format=flowed
X-Trace: ger.gmane.org 1388645948 13857 80.91.229.3 (2 Jan 2014 06:59:08 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 2 Jan 2014 06:59:08 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC6ONSXJ54LBBP44SSLAKGQEJMCRDNY@isocpp.org Thu Jan 02 07:59:14 2014
Return-path: <std-proposals+bncBC6ONSXJ54LBBP44SSLAKGQEJMCRDNY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-bk0-f71.google.com ([209.85.214.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC6ONSXJ54LBBP44SSLAKGQEJMCRDNY@isocpp.org>)
	id 1VycFM-0005ud-P9
	for gclcip-std-proposals@m.gmane.org; Thu, 02 Jan 2014 07:59:12 +0100
Original-Received: by mail-bk0-f71.google.com with SMTP id my13sf24659522bkb.6
        for <gclcip-std-proposals@m.gmane.org>; Wed, 01 Jan 2014 22:59:12 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=zYXp9Z/ZOCGXW05m5sQyz8ALtHTcXyIX87ZKtPYenkk=;
        b=IG1RtkEpn0nrzCVtuWY1iHztynOVWGJMg0mPPmIp/0rlgLuNJUOM/P0Biu7NaHCQSI
         nc4fByHAiqfNMFOIlbc8NgXZH/Nd+zifblazXG1Pcu7vk+J/84Bo+f5/n7k4k4sxxu/c
         QhUNzLWbLzCIvvXV4vG1cs89TOgxEQ2ju4Q7fbrYaDItSdOk7Hf6ImhTKZ1uDHe5boUO
         5bPskTO/v5GieEHQBNx5JyOnoHJ+gQti6GFQM09iOR6qXdCmw/H0DevM+SJ2XalbPiPw
         3GpipVqbT0KHUgyog76rHprm+c5lmOI/ii2NGbvLGb87WK+EgxNjkj4oI8vtd02jURTb
         AjCg==
X-Gm-Message-State: ALoCoQnmezWqYyGUgMwwF6GX0+nbfLpCjT4g8ZeCUu1YKb2qga0Ug2kSstOfOPhBfPffB6KZ4znU
X-Received: by 10.112.17.67 with SMTP id m3mr31542580lbd.8.1388645952182;
        Wed, 01 Jan 2014 22:59:12 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.76.236 with SMTP id n12ls328181wiw.54.canary; Wed, 01 Jan
 2014 22:59:11 -0800 (PST)
X-Received: by 10.14.37.66 with SMTP id x42mr13670741eea.83.1388645951285;
        Wed, 01 Jan 2014 22:59:11 -0800 (PST)
Original-Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9])
        by mx.google.com with ESMTPS id v6si64403522eel.70.2014.01.01.22.59.11
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Wed, 01 Jan 2014 22:59:11 -0800 (PST)
Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of miro@knejp.de) client-ip=212.18.0.9;
Original-Received: from frontend1.mail.m-online.net (unknown [192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 3dw0Tq0C68z4KK2q
	for <std-proposals@isocpp.org>; Thu,  2 Jan 2014 07:59:10 +0100 (CET)
Original-Received: from www.knejp.de (ppp-188-174-111-206.dynamic.mnet-online.de [188.174.111.206])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.mnet-online.de (Postfix) with SMTP id 3dw0Tp4x44zbbm4
	for <std-proposals@isocpp.org>; Thu,  2 Jan 2014 07:59:10 +0100 (CET)
Original-Received: from [192.168.42.4] ([192.168.42.4])
	by www.knejp.de
	; Thu, 2 Jan 2014 07:59:08 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To: <a0ca8331-96b9-4161-b715-f6a780221d85@isocpp.org>
X-Original-Sender: miro@knejp.de
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 212.18.0.9 is neither permitted nor denied by best guess record
 for domain of miro@knejp.de) smtp.mail=miro@knejp.de
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:8354
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8354>

Being able to get a const_iterator from a iterator would sometimes be 
indeed useful. Just not the other way around or people start breaking 
stuff as they tend to do now with const_cast.

An off-topic note about your code: if this is pasted from real-world use 
you probably want to change the single-argument signature of add_vertex 
to accept a non-const vetex_data by value and then std::move() it into 
emplace_back. The current code as it is will always call vertex_data's 
copy constructor because you cannot move from a const object and you end 
up with two copy operations instead of one (or even zero if the argument 
to add_vertex is a temporary).


-- 

--- 
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/.

.
