Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-12 Thread Gabriel Dos Reis
Gennaro Prota <[EMAIL PROTECTED]> writes: | On 12 Jan 2003 10:49:09 +0100, Gabriel Dos Reis | <[EMAIL PROTECTED]> wrote: | | >I believe that that sentence may have been in the first printings of | >TC++PL3 [at the time, I got the third printing, which someone managed | >to steel :-(] | | Here ar

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-12 Thread Gennaro Prota
On 12 Jan 2003 10:49:09 +0100, Gabriel Dos Reis <[EMAIL PROTECTED]> wrote: >I believe that that sentence may have been in the first printings of >TC++PL3 [at the time, I got the third printing, which someone managed >to steel :-(] Here are his words: http://groups.google.com/groups?selm=F439u3.G

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-12 Thread Gennaro Prota
On Sat, 11 Jan 2003 18:26:54 -0800, "Paul Mensonides" <[EMAIL PROTECTED]> wrote: >Yeah. However, this doesn't really apply to what I'm talking about with: > >enum { a, b, c }; > >Yes, for linkage purposes 'enum xyz { }' is equivalent to 'typedef enum { } >xyz'. Well, is the enum below unnamed?

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-12 Thread Gabriel Dos Reis
Terje Slettebø <[EMAIL PROTECTED]> writes: | >From: "Gabriel Dos Reis" <[EMAIL PROTECTED]> | | > What I find confusing about the current rule is that it makes an | > exception for integral type const static data member. I think the old | > rule was less irregular. | > | > (Strangely enought, for

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-11 Thread Terje Slettebø
>From: "Gabriel Dos Reis" <[EMAIL PROTECTED]> > What I find confusing about the current rule is that it makes an > exception for integral type const static data member. I think the old > rule was less irregular. > > (Strangely enought, for long time -- since the publication of TC++PL3 > in 1997 -

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-11 Thread Paul Mensonides
- Original Message - From: "Gennaro Prota" <[EMAIL PROTECTED]> > >Incidently, an unnamed type has no linkage. > > I think the issue is a little more subtle in that a) it's names that > have or don't have linkage, not types b) a typedef allows you to give > a name, for linkage purposes, to

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-11 Thread Gennaro Prota
On Sat, 11 Jan 2003 12:32:16 -0800, "Paul Mensonides" <[EMAIL PROTECTED]> wrote: >> 14.3.1/2 [quote-- >> >> A local type, a type with no linkage, an unnamed type or a type compounded >> from any of these types shall not be used as a template-argument for a >> template type-parameter. >> >> --end q

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-11 Thread Gabriel Dos Reis
Gennaro Prota <[EMAIL PROTECTED]> writes: | On 09 Jan 2003 18:02:51 +0100, Gabriel Dos Reis | <[EMAIL PROTECTED]> wrote: | | >So you propose that the presence/absence of an initializer turns an | >expression designating a static data member into an rvalue or lvalue? | > | >I can't speak for the c

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread scleary
> You would have to have more than one "map_integral" with a different value > name, where the values are dependent on one another and are part of the > public interface. It isn't a complete solution, but it does work in most > cases. For future metaprogramming work (or intermediate values), it m

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread David Abrahams
Terje Slettebø <[EMAIL PROTECTED]> writes: >>From: "David Abrahams" <[EMAIL PROTECTED]> > >> Terje Slettebø <[EMAIL PROTECTED]> writes: >> >> > And since there are techniques for making out-of-class definitions > easier >> > (and automatic), which may be instantiated if needed, like you showed, >

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread Paul Mensonides
- Original Message - From: "Terje Slettebø" <[EMAIL PROTECTED]> > > And since there are techniques for making out-of-class definitions easier > > (and automatic), which may be instantiated if needed, like you showed, then > > static const seems clearly best. > > That's not nearly so easy t

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread Gennaro Prota
On 09 Jan 2003 18:02:51 +0100, Gabriel Dos Reis <[EMAIL PROTECTED]> wrote: >So you propose that the presence/absence of an initializer turns an >expression designating a static data member into an rvalue or lvalue? > >I can't speak for the committee. Personnally, I do know that that >proposal won

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread Terje Slettebø
>From: "David Abrahams" <[EMAIL PROTECTED]> > Terje Slettebø <[EMAIL PROTECTED]> writes: > > > And since there are techniques for making out-of-class definitions easier > > (and automatic), which may be instantiated if needed, like you showed, then > > static const seems clearly best. > > That's n

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread Gabriel Dos Reis
Gennaro Prota <[EMAIL PROTECTED]> writes: | On 09 Jan 2003 15:29:30 +0100, Gabriel Dos Reis | <[EMAIL PROTECTED]> wrote: | | >I'm a long term pro-enum (mostly because for the meta programming | >stuff I had to do, it works very well), but I do understand the | >potential drawbacks raised by the p

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-09 Thread Gennaro Prota
On 09 Jan 2003 15:29:30 +0100, Gabriel Dos Reis <[EMAIL PROTECTED]> wrote: >I'm a long term pro-enum (mostly because for the meta programming >stuff I had to do, it works very well), but I do understand the >potential drawbacks raised by the pro-'static const' camp. Ok. Now for the most stupid qu

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-08 Thread Paul Mensonides
- Original Message - From: "Paul Mensonides" <[EMAIL PROTECTED]> > Actually, this seems to be a bug in Comeau C++: > > #include > #include > > struct A { > enum type { x, y }; > }; > > template struct B { }; > > template inline T operator+(T lhs, T rhs) { > throw 0; > } > >

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread David Abrahams
Terje Slettebø <[EMAIL PROTECTED]> writes: >>From: "Paul Mensonides" <[EMAIL PROTECTED]> >> >> > Just my 2 cents. >> >> Make that 3 cents... >> >> In summary, enumerations are distinct types and therefore can interfere > with >> the rest of the language. Particularly, constant expressions, > over

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Terje Slettebø
>From: "Gennaro Prota" <[EMAIL PROTECTED]> > On Wed, 8 Jan 2003 01:23:05 +0100, Terje Slettebø > <[EMAIL PROTECTED]> wrote: > > >>From: "Gennaro Prota" <[EMAIL PROTECTED]> > > >> It *may* need out-of-class definition, as you say. > > > >Actually, it's pretty clear that in this case, the out-of-cla

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Gennaro Prota
On Wed, 8 Jan 2003 01:23:05 +0100, Terje Slettebø <[EMAIL PROTECTED]> wrote: >>From: "Gennaro Prota" <[EMAIL PROTECTED]> >> It *may* need out-of-class definition, as you say. > >Actually, it's pretty clear that in this case, the out-of-class definition >is required. Indeed. > Intel C++ 7.0, run

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Terje Slettebø
>From: "Paul Mensonides" <[EMAIL PROTECTED]> > > > Just my 2 cents. > > Make that 3 cents... > > In summary, enumerations are distinct types and therefore can interfere with > the rest of the language. Particularly, constant expressions, overloading, > operator overloading, template type deduction

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Terje Slettebø
>From: "Gennaro Prota" <[EMAIL PROTECTED]> > On Tue, 7 Jan 2003 15:35:56 +0100, Terje Slettebø > <[EMAIL PROTECTED]> wrote: > > [...] > >I like static const, as I think it conveys more succinctly what it's about, > >and the enum appears more like a hack (for compilers not handling static > >const

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Paul Mensonides
- Original Message - From: "Paul Mensonides" <[EMAIL PROTECTED]> > Just my 2 cents. Make that 3 cents... In summary, enumerations are distinct types and therefore can interfere with the rest of the language. Particularly, constant expressions, overloading, operator overloading, template

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Paul Mensonides
- Original Message - From: "Gennaro Prota" <[EMAIL PROTECTED]> [...] >I like static const, as I think it conveys more succinctly what it's about, >and the enum appears more like a hack (for compilers not handling static >const in-class initialisation). However, if this means it may need an

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Gennaro Prota
On Tue, 7 Jan 2003 15:35:56 +0100, Terje Slettebø <[EMAIL PROTECTED]> wrote: [...] >I like static const, as I think it conveys more succinctly what it's about, >and the enum appears more like a hack (for compilers not handling static >const in-class initialisation). However, if this means it may n

Re: [boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread Terje Slettebø
>From: "David B. Held" <[EMAIL PROTECTED]> > "Terje Slettebø" <[EMAIL PROTECTED]> wrote in message > 023f01c2b65a$1758e990$cb6c6f50@pc">news:023f01c2b65a$1758e990$cb6c6f50@pc... > > [...] > > Thus, it prefers static const, if it's possible to initialise it in-class, > > on the given compiler, as a

[boost] Re: Metaprogramming: Using static const or enum?

2003-01-07 Thread David B. Held
"Terje Slettebø" <[EMAIL PROTECTED]> wrote in message 023f01c2b65a$1758e990$cb6c6f50@pc">news:023f01c2b65a$1758e990$cb6c6f50@pc... > [...] > Thus, it prefers static const, if it's possible to initialise it in-class, > on the given compiler, as allowed in the standard. However, > "C++ Templates: The