Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #70299

Re: enum type in template declaration

From James Kuyper <jameskuyper@alumni.caltech.edu>
Newsgroups comp.lang.c++
Subject Re: enum type in template declaration
Date 2019-12-05 22:39 -0500
Organization A noiseless patient Spider
Message-ID <qscii5$5an$1@dont-email.me> (permalink)
References <qsbvs3$81l$1@dont-email.me>

Show all headers | View raw


On 12/5/19 5:20 PM, Soviet_Mario wrote:
> since what version of standard, if any, an ENUM type can be 
> an argument of a template ?

It has always been possible to use an enumerated type as a template
parameter. There is no special rule giving a enumerated type any
different status from any other type in that regard.

> sth like
> 
> enum RestrictedValues { A = 1, B = 2, C = 4, D = 8 };
> 
> 
> template <RestrictedValues ttVal> class SizedField

However, you're not using an enumerated type as a template argument,
you're using a enumeration value. That is a marginally newer feature of
C++, though I believe that it still pre-dates the first version of the
standard. There is no distinction for this purpose between values of
enumerated type and those of any other integer type.


Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

enum type in template declaration Soviet_Mario <SovietMario@CCCP.MIR> - 2019-12-05 23:20 +0100
  Re: enum type in template declaration James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-05 22:39 -0500
    Re: enum type in template declaration Soviet_Mario <SovietMario@CCCP.MIR> - 2019-12-06 13:15 +0100
      Re: enum type in template declaration Paavo Helde <myfirstname@osa.pri.ee> - 2019-12-06 14:42 +0200
        Re: enum type in template declaration Soviet_Mario <SovietMario@CCCP.MIR> - 2019-12-06 17:20 +0100
          Re: enum type in template declaration Paavo Helde <myfirstname@osa.pri.ee> - 2019-12-06 20:29 +0200
            Re: enum type in template declaration Soviet_Mario <SovietMario@CCCP.MIR> - 2019-12-06 22:42 +0100
              Re: enum type in template declaration Paavo Helde <myfirstname@osa.pri.ee> - 2019-12-07 00:51 +0200
                Re: enum type in template declaration Soviet_Mario <SovietMario@CCCP.MIR> - 2019-12-07 18:54 +0100
      Re: enum type in template declaration Öö Tiib <ootiib@hot.ee> - 2019-12-06 06:00 -0800
      Re: enum type in template declaration James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-06 09:56 -0500
      Re: enum type in template declaration Manfred <noname@add.invalid> - 2019-12-06 15:56 +0100
  Re: enum type in template declaration Soviet_Mario <SovietMario@CCCP.MIR> - 2019-12-06 18:43 +0100
  Re: enum type in template declaration saturnman2008@gmail.com - 2019-12-07 01:53 -0800
    Re: enum type in template declaration Soviet_Mario <SovietMario@CCCP.MIR> - 2019-12-07 18:57 +0100

csiph-web