- Original Message -
From: "David Abrahams" <[EMAIL PROTECTED]>
> > I guess it would depend heavily on the compiler used. For instance, a
> > compiler might not actually create the storage at all unless the address
of
> > the static const is actually needed--which would cause the effect t
"Paul Mensonides" <[EMAIL PROTECTED]> writes:
> - Original Message -
> From: "David Abrahams" <[EMAIL PROTECTED]>
>
>
>> "Paul Mensonides" <[EMAIL PROTECTED]> writes:
>>
>> >> > Well, yes. If you do that, however, it removes one of the primary
>> > reasons
>> >> > to use enumerations, whi
- Original Message -
From: "David Abrahams" <[EMAIL PROTECTED]>
> "Paul Mensonides" <[EMAIL PROTECTED]> writes:
>
> >> > Well, yes. If you do that, however, it removes one of the primary
> > reasons
> >> > to use enumerations, which is for the syntactic convenience. The
only
> >> > reas
"Paul Mensonides" <[EMAIL PROTECTED]> writes:
>> > Well, yes. If you do that, however, it removes one of the primary
> reasons
>> > to use enumerations, which is for the syntactic convenience. The only
>> > reason left to use enums is to avoid the static storage of the
>> > values.
>>
>> And to
- Original Message -
From: "David Abrahams" <[EMAIL PROTECTED]>
> >> Now Y::value and Y::value have the same type. Of course,
> >> you will probably want some additional tools in integral_c, like
> >> an explicit conversion to an rvalue of type T.
>
Misread it, sorry.
> >
"Paul Mensonides" <[EMAIL PROTECTED]> writes:
> - Original Message -
> From: "David Abrahams" <[EMAIL PROTECTED]>
>
>> > solution:
>> >
>> > There is no non-intrusive solution. It must be cast at the call site to
> a
>> > common type (such as 'int' or 'bool') in order to avoid replicated
- Original Message -
From: "David Abrahams" <[EMAIL PROTECTED]>
> > solution:
> >
> > There is no non-intrusive solution. It must be cast at the call site to
a
> > common type (such as 'int' or 'bool') in order to avoid replicated
template
> > instantiation.
> >
> > */
>
> Of course,
"Paul Mensonides" <[EMAIL PROTECTED]> writes:
> func( Y::value ); // okay.
>
> // A temporary is created of type 'Y::value_type'.
> // The address of that temporary is bound to
> // the const& parameter of 'func'.
> // 'func' is instantiated with 'T' == 'Y::va
- Original Message -
From: "Terje Slettebø" <[EMAIL PROTECTED]>
> Right, but members of anonymous namespaces does have external linkage, so
> this is not an example of that. That's an advantage over the deprecated
> file-scope static, which does have internal linkage, and is therefore
> u
>From: "Paul Mensonides" <[EMAIL PROTECTED]>
> > 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 quote]
>
> Incidently, an unna
"Paul Mensonides" <[EMAIL PROTECTED]> writes:
[...]
| However, this
| raises another interesting problem. Many enumerations used for this purpose
| are unnamed:
|
| template struct is_ptr {
| enum { value = false };
| };
|
| templat
- Original Message -
From: "Daniel Frey" <[EMAIL PROTECTED]>
Terje Slettebø wrote:
>
> > Just to make sure: Do you "vote" in favor of enums? I have seen problems
> > with 'static const ...', but I have never seen problems with enums
> > (although they theoretically exist).
>
> Not just the
Daniel Frey <[EMAIL PROTECTED]> writes:
| > Yes, a smarter compiler may do better, but such smarter compilers are
| > quite rare :-)
| > Yes, the thingy ends up in the link map (as a local symbol).
|
| Just to make sure: Do you "vote" in favor of enums?
I'm a long term pro-enum (mostly because f
Terje Slettebø wrote:
>
> > Just to make sure: Do you "vote" in favor of enums? I have seen problems
> > with 'static const ...', but I have never seen problems with enums
> > (although they theoretically exist).
>
> Not just theoretically. As mentioned in an earlier posting in this thread,
> BCC
>From: "Daniel Frey" <[EMAIL PROTECTED]>
> Gabriel Dos Reis wrote:
> >
> > I'm not one the authors of the book mentioned but I will say what I
> > know (from experience both as a user and casual implementor). The
> > issue of enum/static const is an endless debate. However, one thing is
> > sure:
Gabriel Dos Reis wrote:
>
> I'm not one the authors of the book mentioned but I will say what I
> know (from experience both as a user and casual implementor). The
> issue of enum/static const is an endless debate. However, one thing is
> sure: Even with the amended paragraph in the Standard (re
David Abrahams <[EMAIL PROTECTED]> writes:
| Terje Slettebø <[EMAIL PROTECTED]> writes:
|
| > Static constant members are lvalues. So, if you have a declaration such as
| >
| > void foo(int const&);
| >
| > and you pass it the result of a metaprogram
| >
| > foo(Pow3<7>::result);
| >
| > a compil
Terje Slettebø <[EMAIL PROTECTED]> writes:
> Static constant members are lvalues. So, if you have a declaration such as
>
> void foo(int const&);
>
> and you pass it the result of a metaprogram
>
> foo(Pow3<7>::result);
>
> a compiler must pass the address of Pow3<7>::result, which forces
> the co
Terje Slettebø wrote:
>
> BOOST_STATIC_CONST is defined in Boost.Config as:
>
> # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
> # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
> # else
> # define BOOST_STATIC_CONSTANT(type, assignment) static const type
> assignm
Hi.
BOOST_STATIC_CONST is defined in Boost.Config as:
# ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
# else
# define BOOST_STATIC_CONSTANT(type, assignment) static const type
assignment
# endif
Thus, it prefers sta
20 matches
Mail list logo