220 9903 <lgcl91$uln$1@ger.gmane.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Woehlke <mw_triad@users.sourceforge.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Explicitly-defaulted enumeration operators
Date: Wed, 19 Mar 2014 13:48:31 -0400
Lines: 43
Approved: news@gmane.org
Message-ID: <lgcl91$uln$1@ger.gmane.org>
References: <3B09C97E-7ADE-49ED-8C31-B5B41CD3DDE7@gmail.com> <781009e3-cd3c-4cb8-b034-b51a7c97c750@isocpp.org> <E797CAFE-4967-4881-870D-569BF15C757E@gmail.com> <10450602-fee9-48c4-9fa2-d000e434f5fb@isocpp.org> <6F532E62-C10A-404A-8F0D-662B7EA3D202@gmail.com> <24e85eaf-e67b-4a0b-acee-47d996d6f6ee@isocpp.org> <7F327393-B9EF-46EB-A40E-86F80EFEF5BD@gmail.com> <c17acc18-db6f-4233-b819-49bb623259dd@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
X-Trace: ger.gmane.org 1395251332 31922 80.91.229.3 (19 Mar 2014 17:48:52 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 19 Mar 2014 17:48:52 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCO5FYHBU4ERBCNRU6MQKGQENYPHDWY@isocpp.org Wed Mar 19 18:49:01 2014
Return-path: <std-proposals+bncBCO5FYHBU4ERBCNRU6MQKGQENYPHDWY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-we0-f200.google.com ([74.125.82.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCO5FYHBU4ERBCNRU6MQKGQENYPHDWY@isocpp.org>)
	id 1WQKbq-0000q3-Ep
	for gclcip-std-proposals@m.gmane.org; Wed, 19 Mar 2014 18:48:58 +0100
Original-Received: by mail-we0-f200.google.com with SMTP id p61sf14006032wes.11
        for <gclcip-std-proposals@m.gmane.org>; Wed, 19 Mar 2014 10:48:58 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent: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=DCRlsdz47w7XEtQrv7l8GUbm2iItaDQl0q25pjvglqs=;
        b=YnscIl7iMzKIZJboTUJR7o3GaQB11MKmADmC0/Yy8O24H2CfUvTL/R94o9yScGGhWz
         O0hzLWlsGhg6q6v98H/NPGe8o484++dGafo3FPba+1l4SRDEi/vIV3sBzCOwyylS2+Lz
         B/3Mrczj5lsMgG0RAR6GrgmHJzizGqvjlR2JimlWdWpcXwZJmNlq2nmF8rv8Rc/s+puP
         Xxi7Jxpzba8D+jrEExheGu+6ene7X9tLC1mAsc0RoE/KfcKeHJHDJ5nEmoRQEv0wjIuG
         ZqYkgL8CwE8eMka91vUvkmBVJjnRzK2FRTiA57s/L2FED3gDa9wtKtt1YzyTypJvib1X
         Mxhw==
X-Gm-Message-State: ALoCoQmJ6bxj00TKGaFUoWFI3mhS8emSYaOgbPBJzjuxpZhlgLxNx5E+6K7n49pSl/FrVvDsre0H
X-Received: by 10.112.144.165 with SMTP id sn5mr13963780lbb.11.1395251338126;
        Wed, 19 Mar 2014 10:48:58 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.234.172 with SMTP id uf12ls361147lac.85.gmail; Wed, 19 Mar
 2014 10:48:57 -0700 (PDT)
X-Received: by 10.152.246.43 with SMTP id xt11mr2696502lac.34.1395251337081;
        Wed, 19 Mar 2014 10:48:57 -0700 (PDT)
Original-Received: from plane.gmane.org (plane.gmane.org. [80.91.229.3])
        by mx.google.com with ESMTPS id y6si16641054lal.194.2014.03.19.10.48.56
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Wed, 19 Mar 2014 10:48:56 -0700 (PDT)
Received-SPF: pass (google.com: domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as permitted sender) client-ip=80.91.229.3;
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1WQKbf-0000WQ-3R
	for std-proposals@isocpp.org; Wed, 19 Mar 2014 18:48:47 +0100
Original-Received: from tripoint.kitware.com ([66.194.253.20])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Wed, 19 Mar 2014 18:48:47 +0100
Original-Received: from mw_triad by tripoint.kitware.com with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Wed, 19 Mar 2014 18:48:47 +0100
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 34
Original-X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: tripoint.kitware.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
In-Reply-To: <c17acc18-db6f-4233-b819-49bb623259dd@isocpp.org>
X-Original-Sender: mw_triad@users.sourceforge.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as
 permitted sender) smtp.mail=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: <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:9903
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/9903>

On 2014-03-18 01:01, Matheus Izvekov wrote:
> Hmm, but suppose you could write something like this:
>
> enum class flags : uint32_t {
>     foo = 1, bar = 2, baz = 4;
>     flags operator|(flags,flags) = default;
> };

That would be awesome. In fact I have a 'to do' to suggest exactly this.

std::flags might cover that specific use case, but I also want to be 
able to do things like:

   enum class foo {
     ...values...
     foo(std::string const*); // constructor
     operator std::string(); // conversion operator
   };

(These sorts of conversions already show up frequently, but right now 
must be implemented as free functions; the ability to make them members 
would be great.)


Something else I would really love to see though is using an enumeration 
as an underlying ("base") type of an enumeration, e.g.:

   enum class A { a1, a2, ... };
   enum class B : A { b1, b2, ... };

   B bb = B::a1; // legal; a1, etc. are in scope of B, inherited from A

-- 
Matthew

-- 

--- 
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/.

.
