220 25596 <20160420054934.GA31261@noemi.bahnhof.se> article
Path: news.gmane.org!not-for-mail
From: Magnus Fromreide <magfr@lysator.liu.se>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Linked std::table / std::matrix proposal
Date: Wed, 20 Apr 2016 07:49:34 +0200
Lines: 69
Approved: news@gmane.org
Message-ID: <20160420054934.GA31261@noemi.bahnhof.se>
References: <df7aa05f-abaa-47bc-8946-86e7817e4a63@isocpp.org>
 <20160416005425.4902992.3247.9842@gmail.com>
 <CADbh+eTe1b75Sg8kwDn2RAsQf4geuGO+otDyGoB4f6Z1V45byQ@mail.gmail.com>
 <CALcgO_5ivw4f_N4CpsogxsaOEpT-EK4UwVELtj_DCNAHfPxb9Q@mail.gmail.com>
 <CAOHCbivEq6bf+6j1AejSZvcg7zTX=sH6KB4eiNrWLZ5xNAzazg@mail.gmail.com>
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 1461131386 2817 80.91.229.3 (20 Apr 2016 05:49:46 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 20 Apr 2016 05:49:46 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDELLREETMBRB4FQ3S4AKGQEJ3YOGEQ@isocpp.org Wed Apr 20 07:49:40 2016
Return-path: <std-proposals+bncBDELLREETMBRB4FQ3S4AKGQEJ3YOGEQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f197.google.com ([209.85.217.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDELLREETMBRB4FQ3S4AKGQEJ3YOGEQ@isocpp.org>)
	id 1asl18-00063K-Dh
	for gclcip-std-proposals@m.gmane.org; Wed, 20 Apr 2016 07:49:38 +0200
Original-Received: by mail-lb0-f197.google.com with SMTP id f14sf3434793lbb.2
        for <gclcip-std-proposals@m.gmane.org>; Tue, 19 Apr 2016 22:49:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:subject:message-id:mail-followup-to:references
         :mime-version:content-disposition:in-reply-to:user-agent
         :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=O3FToLEJJxh6B9wh+PGm+hXddA8hFY/N6Oo5zmo4BIw=;
        b=JeygAWi8hevvPp/xUnKp0JMRP2p8z5hZQbBFytrfvqLagWPeK27YF11ZNTBmpDHHNt
         8EfRPRUIoHCBqjB/IBHj9lbw7SI+MmebLGOVpOekH5Fd/UgXdRv7v6Bsaf7wy2JgE7ru
         /3LDhhcoo5DK+VBy5Xgn/kI4wCVtThyT7AkG6hPV/YEtcPvV1J4LeOtBGf4sneN3Rps4
         a3iunbrgzrHwowAWF2CmsfWwpR+Nmq3issJNh32b+C9sI7ugSv/9mIBocM+UXM6XRdK5
         KRDve8M7zOfRypf7cZnUEuij5YRSj3uhPjNMWinEnYGccaltzldd5hjwBukjBYY 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to
         :references:mime-version:content-disposition:in-reply-to:user-agent
         :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=O3FToLEJJxh6B9wh+PGm+hXddA8hFY/N6Oo5zmo4BIw=;
        b=ecLWfiR0gVpyzDE+2atZXrYgfRZ9U2txDd6osYrp61jr4L/O8sbq8W/Ld4RpkVu0rD
         Yy1DLj07iVxJnxR2KK6qArZDAbdBq92od1/9YwHVZExLT6Wkvt9QMUqs4eB1PEOXbvgR
         +lGAK0+VG5ELkd7auTaBOv6rVvEUMrigS7spW8o9nsscq/QLGdvH7cTjyhJbAMY7EKvz
         wGSD6ERyr7JGejFD/jOJpjVYr7hCmf/0RKhPYln4aj9yBEzJ8+dyNnyfNS6wHHTGhLQM
         4OeZLLaefNcXeZ5Rl4jzH2akAcUKc91t3WWpl88lbMyzsTjVhJdIawcrBCm 
X-Gm-Message-State: AOPr4FXpAzmt5R+E3HMtNRxZ1Z2ZvPo2Svc/1VbZo4NMPOBi4Q1EYdsUwsVo5ZVQE0eIgw==
X-Received: by 10.25.15.68 with SMTP id e65mr709524lfi.8.1461131377850;
        Tue, 19 Apr 2016 22:49:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.25.16.93 with SMTP id f90ls599524lfi.89.gmail; Tue, 19 Apr
 2016 22:49:36 -0700 (PDT)
X-Received: by 10.25.151.72 with SMTP id z69mr2849030lfd.0.1461131376132;
        Tue, 19 Apr 2016 22:49:36 -0700 (PDT)
Original-Received: from mail.lysator.liu.se (mail.lysator.liu.se. [2001:6b0:17:f0a0::3])
        by mx.google.com with ESMTPS id r78si2361794lfg.122.2016.04.19.22.49.36
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 19 Apr 2016 22:49:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of magfr@lysator.liu.se designates 2001:6b0:17:f0a0::3 as permitted sender) client-ip=2001:6b0:17:f0a0::3;
Original-Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id C8E704001C
	for <std-proposals@isocpp.org>; Wed, 20 Apr 2016 07:49:35 +0200 (CEST)
Original-Received: from noemi.bahnhof.se (h-176-10-249-241.na.cust.bahnhof.se [176.10.249.241])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id A2D1540012
	for <std-proposals@isocpp.org>; Wed, 20 Apr 2016 07:49:35 +0200 (CEST)
Mail-Followup-To: std-proposals@isocpp.org
Content-Disposition: inline
In-Reply-To: <CAOHCbivEq6bf+6j1AejSZvcg7zTX=sH6KB4eiNrWLZ5xNAzazg@mail.gmail.com>
User-Agent: Mutt/1.5.24 (2015-08-30)
X-Virus-Scanned: ClamAV using ClamSMTP
X-Original-Sender: magfr@lysator.liu.se
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of magfr@lysator.liu.se designates 2001:6b0:17:f0a0::3 as permitted
 sender) smtp.mailfrom=magfr@lysator.liu.se
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: <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:25596
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/25596>

On Tue, Apr 19, 2016 at 08:21:55PM -0400, Tony V E wrote:
> On Sat, Apr 16, 2016 at 1:06 PM, Michael Allwright <allsey87@gmail.com>
> wrote:
> 
> >
> > I'm not exactly sure what you mean by ruling out vector-of-vector
> > implementations, I'm suggesting adding a new container to the standard, not
> > removing anything. The vector-of-vectors approach is certainly ok for
> > situations where the layout and dimensions of the table/matrix are
> > relatively fixed, but in the case where we need to add/remove/shift columns
> > and rows, the code to do this can be quite unsafe and bloated.
> >
> >
> When you define a container for the standard, you don't define how it is
> implemented, you only define how it looks from the outside - its API. You
> _somewhat_ limit how it might be implemented by providing certain
> guarantees - ie
> 
> - do iterators get invalided when adding/removing (for examples in STL:
> vector yes, list no)
> - what is the O(n) time for inserting, removing, etc,
> - are the iterators ForwardIterators, BidirectionalIterators, or
> RandomAccessIterators, etc
> - etc

I could not agree more with this and would vey much see this added as a FAQ or
something to the group.

> > This container doesn't aim to solve problems such as implementing large
> > databases or solving large sets of simultaneous equations through matrix
> > operations, boost already has some quite sophisticated solutions for this.
> > The aim of this container is to provide programmers with a tool to safely
> > manipulate small to medium sets of data that is organised as rows and
> > columns.
> >
> >
> So this is exactly what we need to focus on - what is the aim, and was is
> NOT the aim. (Like you say, NOT solving equations, etc).
> 
> So we need to decide what trade-offs to make - which operations should be
> fast, which don't matter - do we expect users to traverse more, or
> insert/remove more?  Do they want to hold iterators, then insert/remove,
> then continue to use those old iterators expecting them to still point to
> where they previously did?
> 
> P.S. I specifically bring up vector of vector, because it will, in many
> cases, probably be faster than a node-based container - even when doing
> significant inserts etc.  Vectors keep data local in memory (ie keep cache
> lines happy), node-based containers spread the data out across memory.  And
> allocation is slow (and typically requires a lock for thread safety).  So
> allocating a single node vs moving a bunch of data over in a vector...
> vector often wins.

Here I have to say that I think the implementation using a vector with
striding iterators should be considered as well - given that the container
is small it might end up beeing faster than both vector-of-vectors and
linked webs.
This also have the advantage that the whole thing becomes an new adaptor
rather than a new container so you could put it on top of any random-
iterable container.

/MF

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/20160420054934.GA31261%40noemi.bahnhof.se.

.
