From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107715 invoked by alias); 7 Feb 2018 16:06:18 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 107701 invoked by uid 89); 7 Feb 2018 16:06:17 -0000 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) Subject: Re: [PATCH 2/3] dynarray: Implement remove function To: Alexander Monakov Cc: libc-alpha@sourceware.org References: <1518008967-8310-1-git-send-email-adhemerval.zanella@linaro.org> <1518008967-8310-2-git-send-email-adhemerval.zanella@linaro.org> From: Adhemerval Zanella Message-ID: Date: Wed, 07 Feb 2018 17:16:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-02/txt/msg00262.txt.bz2 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.