From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Adhemerval Zanella Newsgroups: gmane.comp.lib.glibc.alpha Subject: Re: [PATCH 2/3] dynarray: Implement remove function Date: Wed, 7 Feb 2018 14:06:09 -0200 Message-ID: References: <1518008967-8310-1-git-send-email-adhemerval.zanella@linaro.org> <1518008967-8310-2-git-send-email-adhemerval.zanella@linaro.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1518019480 9778 195.159.176.226 (7 Feb 2018 16:04:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 7 Feb 2018 16:04:40 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: libc-alpha@sourceware.org To: Alexander Monakov Original-X-From: libc-alpha-return-90116-glibc-alpha=m.gmane.org@sourceware.org Wed Feb 07 17:04:36 2018 Return-path: Envelope-to: glibc-alpha@blaine.gmane.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=ySosM8rzx31d2Ucs ulQMQErTHRiAxnR9TkB9MT7A8tGkrNO04LzIO4pt6MiDZB/Uub2Wv+4zT2PaFOun c8EV19wyJDq47MgKgSxTDqzlQfZi9GQSpZ6LmYV1qmnz68EE6zKuCZ1XCkUb2j9J UTH0IwcooVaXZ5+ULj/A/b8xjKk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=q06pBJSqBpieIfPmnOFV7N R8G/k=; b=LrsNN7oW/1AIIScYlVE3x2en6V7lEltnxVR2tM9QpHPBDisvd8oECd m428I3hekUmb2ktpibhtyqR2lHJSvcHfY0VbXeomFRbABQXQz+m6LW2hXnt2fav8 15xpfn47iH+RQS3nDVEklblh430KDupGC42jjH+CeNIN9pZLSuPh0= Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: libc-alpha-owner@sourceware.org Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:893, HContent-Transfer-Encoding:8bit X-HELO: mail-qk0-f193.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YE78oRmx7wavmK8ZzPKMgJv0B2z01gMA9AwKjT9vesw=; b=XxjFNPEM+D2nKGxmOQqBvkzu5p2aBqit+wenA3KCere+uWMmT2uo1mqHXZE7UdEegO eCiyDrWnIRrKM4YDtHcVJ/RVciWzC1M+Ab51xAZ3JIGuay2d0Hagw5z7+2J6f0zZ3QHh DCQ88TJqIyzHfniHk/rmgTr840Fz6Fl4EJbnXWWagA5b5b8LJLSk1EusMyqoF2ES7xPU DsBYuSfFVZM6OGuGUsuFYpvquTIRp7t2i30nEFQ6VOo13Bn1Az03KYJ4s/CZiuUEg9fH qQytLyz+M09taOioVykaQ1DhonH9A3kzdZeKYNjzr31J2vyvKHw7GBxb5QuztR3ETpC7 fc3g== X-Gm-Message-State: APf1xPAD3tKeyX+S7B/Wn1xWSOTKk0YEVsDRvJvDBqoqWXICBvtFBpAv 3NdnkG28do/PyTRFv0YcyZFCBfmR3/c= X-Google-Smtp-Source: AH8x224tVfBvAwuTkcwC0ylQcSv4hKEfhhjuSZRnlIaU54tMyHx+pSk8omIac/vXraVQwgWzjyEzMw== X-Received: by 10.55.6.15 with SMTP id 15mr9924286qkg.285.1518019574157; Wed, 07 Feb 2018 08:06:14 -0800 (PST) In-Reply-To: Xref: news.gmane.org gmane.comp.lib.glibc.alpha:82464 Archived-At: Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejSCm-0001I1-Tc for glibc-alpha@blaine.gmane.org; Wed, 07 Feb 2018 17:04:17 +0100 Received: (qmail 107715 invoked by alias); 7 Feb 2018 16:06:18 -0000 Received: (qmail 107701 invoked by uid 89); 7 Feb 2018 16:06:17 -0000 On 07/02/2018 12:48, Alexander Monakov wrote: > On Wed, 7 Feb 2018, Adhemerval Zanella wrote: > >> This patch implements the remove item function for dynarray array. >> It is a costly operation, since it requires a memory move operation >> possible as large as the array size less one element. > > If preserving order is not required, then removing an element is as > cheap as moving only the last element to the position of the removed. > > If order preservation, is, in fact, part of the intended interface, > then shouldn't the new function be named like '..._ordered_remove' > to reflect that? > > Alexander > I see dynarray works similar to c++ vector container and the remove usage on subsequent patch expects order preservation. So I would prefer to use the other way around your suggestion: to add a unordered_remove if the case.