220 33527 <ols5h1$450$1@blaine.gmane.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Bo Persson <bop@gmb.dk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: A more advanced switch
Date: Wed, 2 Aug 2017 11:20:39 +0200
Lines: 37
Approved: news@gmane.org
Message-ID: <ols5h1$450$1@blaine.gmane.org>
References: <f8c908e2-d06f-4cd1-bda0-fe2b97fd21f1@isocpp.org>
 <9d888362-46f2-4317-b4ea-4376159d8ef1@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
X-Trace: blaine.gmane.org 1501665659 9554 195.159.176.226 (2 Aug 2017 09:20:59 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 2 Aug 2017 09:20:59 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.2.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCZ6RLW3UIKBB5NSQ3GAKGQEZEYL4AI@isocpp.org Wed Aug 02 11:20:55 2017
Return-path: <std-proposals+bncBCZ6RLW3UIKBB5NSQ3GAKGQEZEYL4AI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f71.google.com ([209.85.215.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCZ6RLW3UIKBB5NSQ3GAKGQEZEYL4AI@isocpp.org>)
	id 1dcppk-0001rp-1y
	for gclcip-std-proposals@m.gmane.org; Wed, 02 Aug 2017 11:20:52 +0200
Original-Received: by mail-lf0-f71.google.com with SMTP id h89sf9652283lfi.11
        for <gclcip-std-proposals@m.gmane.org>; Wed, 02 Aug 2017 02:20:55 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1501665655; cv=pass;
        d=google.com; s=arc-20160816;
        b=jT1E+1kAg9uUN/xDeaoaByOgaqysFBiiTq0DX3rzOmUnGBWjTgaYDTkzElycC9gCZr
         oEfMmWz6zxbCoLgJ1TpjazUlygpaI4IUQ9rEwCymR+ewzE/W8+xfG20PUHTCuVLk3Wmw
         dA0OAQRFY9EBNq2SWbAmzThjCBGMkiWviq/knjxCWwmI+NgF55dZt7dQ0QF0Fkr4AqZg
         6J1astEv63SHgAmYyVyHyzwHsys6Uq7QvOj+3eVZaPg8CwMBSLbgcBqMRcpSB9ltZva5
         jdyYP066SNii5/U02OIoYL6VxzWL6kfSbz0nBZfO65BENGlcxeAsEk8ALaHgM3TBZ7Pf
         2C8w==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:user-agent:mime-version:references:message-id:lines
         :date:subject:from:to:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=ig4lxIm/NPCkUDukDegsaRv9pYQosqOPccGMzvKSoHU=;
        b=K872uSE9Kj5jesRUy74r45a4Rrj5pu/ls/6lVk+UoGYpwgj4qGYvQjLfY9J8GmB07T
         ee2y6r77VyLpmzV73pitlAtBUSpY2nsaTDSEwaoDnuquKma3NcukkXva/Rf9AOkRgB+n
         jA+xV3IXiBzQkdSzj7scZAcna+prNelirdr71n2AdT5QiLgsvN/71pxXZK1Ixb0xZ2bu
         3Y6WWzPhUf/jUQ69mJUxQzoDC4lG82C5xZx9m/ox+Hm3fDmxPWLKdI7th+MgVoceMQcA
         xjpwPhZKtV+ItKFZ85NaV1l8uzYiDTeJq0oWquOugiLDKkb62O7ogZq0Nt/rkLlzpLro
         Zdig 
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:date:lines:message-id:references:mime-version
         :user-agent:in-reply-to:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=ig4lxIm/NPCkUDukDegsaRv9pYQosqOPccGMzvKSoHU=;
        b=ACCW72rtsbdPTXhQx8hS8auWsoyCfHxhYx4MeeDx/yORJdrlh5LVHidOEL+IVJ/l3b
         8Eu+mnXJXmT8tH1krrz1Dr7yQJBk2PoFVt+3djMSEOAD9bqHTcYMQCN1xnYSb0gUlKMX
         fokGgxuV6RjyGjhWUzitZDnPG0MnEssArilLvRFI3cAZo9ZhKXu7uTEdPc4k2dG3ur6l
         6wgO3M9HKLFuJKTo7t0EquWj/6AS1BZczfurz+6AiYH1PNY0xnqR1Th/CInMnw9zH9tv
         9IlPzVp+TDC3+lHFfp/+z7yX2wbnc7cyqjs66GDBmww0jeSkAkLwGxilic+f5mFSS94l
         go8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-to:content-language
         :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=ig4lxIm/NPCkUDukDegsaRv9pYQosqOPccGMzvKSoHU=;
        b=emlgUeT0SgtfaZLsIps7YHeS3y9OGVT5RBywOp/gsKmAXrha5FwMUxtMRWiZodI9vl
         LAs6X8XhNJ/reZav07ouTedpph78iugPUWvB24FQtViIdMsCWFyeoauzxfzUqOuhmTyj
         sUFDz7e92fMlBS/VqP0cP8MUAcyWndVLt22K0YbZR+ziyMzYjF2pJrtGz+/YgdMFTlKe
         /pDRHqphyxMmmk3XjZJEgq0OerPsh/coRID6X8T7HZ8wJ7c6wobwE+bUwtRE7toUb3oR
         bvT547hBu9ZAel93EFLy9bIYThlxMVdOuqTfnwe+g8g0nU/JYiq14B1Q6ZYzmtP3lgIt
     
X-Gm-Message-State: AIVw110cbXclfXcFhHHWciqvOEx2mfRwvTUzjPt8P+PhjHgPhrIzEWKg
	gXCE7Ibs8ycwpw==
X-Received: by 10.46.83.27 with SMTP id h27mr2044113ljb.35.1501665655005;
        Wed, 02 Aug 2017 02:20:55 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.25.33.85 with SMTP id h82ls410381lfh.10.gmail; Wed, 02 Aug
 2017 02:20:52 -0700 (PDT)
X-Received: by 10.25.190.206 with SMTP id o197mr8400294lff.208.1501665652678;
        Wed, 02 Aug 2017 02:20:52 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1501665652; cv=none;
        d=google.com; s=arc-20160816;
        b=T0YSs7mPV2lIpI7G6L8EyBsEmBaJ/t8PdqacoqotjWISAuoNU48h2QFRQvjbushH6f
         x3prP54PWaKHsw1LX9XdZpE5HbWvaLesMDZJ6vkQTGmfS11nZt+eylwKttxaIjmMOCgg
         /scdxN1PgS4CgqHoaFYCUvhNz5tHrj4gXoLj5y8LRrHl8z2MlzHm02KUq0y3mxHJOH3W
         PzQaI39JfDK40vng4Ob4pkO/75UM3Yb4AHe+CjPnjsOg0mSvf5Y8xVXR+L2EHbz8t6E3
         tAPxXTTTG9o+Hs604OjWAsA4BaBiLMwt9ZHgMZJc/0AGJMALvt6gOk/+NsE4q/1MxVr6
         /GqQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-language:in-reply-to:user-agent:content-transfer-encoding
         :mime-version:references:message-id:lines:date:subject:from:to
         :arc-authentication-results;
        bh=9r8B9XqHe19Pfhgbx/YgQXXZrEFherRCocfZcIm7O4M=;
        b=Z/nlAjE+q1u4p+mHXHqigjOzf/wdbmClHyzWWRhcXgR7G3fBNE0yGxPW2pohtw7jyk
         c8QDN590LZAZtNKQsHu+9h0P20lwIxP8UcdJ7BmCYQRB3OlFac7EzDIVwJW1F8GC8OEC
         QwNx8QRcQzmOFN4UTlrZ/n/gz8AlZQxjxzxAmr2pUI5uPiv6O/uDijhR0uM00u+LVjhU
         O1zCZAoQrt0SX9d3FaD39wgs19+UjYTRpNPXCr/a7+iR47CVmbgXZ6Hsd9TDzaurT4sB
         RuhQ586Rnt4cgKHoGP3KkmbjkY7nRQaxNBZZvgxOyKCrOyADSJivDqhAchuBMk/wdQco
         T3xA==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
Original-Received: from blaine.gmane.org ([195.159.176.226])
        by mx.google.com with ESMTPS id x67si6812469lff.144.2017.08.02.02.20.52
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 02 Aug 2017 02:20:52 -0700 (PDT)
Received-SPF: neutral (google.com: 195.159.176.226 is neither permitted nor denied by best guess record for domain of gclcip-std-proposals@m.gmane.org) client-ip=195.159.176.226;
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1dcppY-0001S1-0y
	for std-proposals@isocpp.org; Wed, 02 Aug 2017 11:20:40 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 30
Original-X-Complaints-To: usenet@blaine.gmane.org
In-Reply-To: <9d888362-46f2-4317-b4ea-4376159d8ef1@isocpp.org>
Content-Language: sv
X-Original-Sender: gclcip-std-proposals@m.gmane.org
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 195.159.176.226 is neither permitted nor denied by best guess
 record for domain of gclcip-std-proposals@m.gmane.org) smtp.mailfrom=gclcip-std-proposals@m.gmane.org
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: <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:33527
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33527>

On 2017-08-01 23:53, Vishal Oza wrote:
> I like the idea of adding new of adding to the switch statement but I think lets take it futher
> switch (v)
> {
> case v= [1,5]: //incusive 1 to 5 1 <= v <= 5
>        Dosomething();
>        break;
> case v = (5, 10): //exclusive range 5 < v < 10
>        doSomethingelse1();
>        break;
> case v = (10, 50 ]: // 10 < v <= 50
>        doSomethingElse2();
>        break;
> case v = (50,...) // 50 < v
>        doSomethingElse3();
>        break;
> case v = 50:
>        doSomethingElse4();
>        break;
> }
> Valid for only if v is numeric also add multi variable values and strings
> 

If you have large ranges, the compiler might translate that similar to 
an if-statement anyway. Especially the (50,...) cannot easily be used in 
  a jump table.


     Bo Persson


-- 
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/ols5h1%24450%241%40blaine.gmane.org.

.
