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 compiler must pass the address of Pow3<7>::result, which forces | > the compiler to instantiate and allocate the definition for the | > static member. As a result, the computation is no longer limited to | > a pure "compile-time" effect. | | I buy everything but the last sentence. What do they mean? Does the | thing go into the link map? If not, what?
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 (redefinition of "used"), passing an lvalue to a function that expects a const reference more or less takes the referenced entity's address, and as such makes the "static const object" used, therefore a definition is required. One looses the "purely compile-time constant" aspect. 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). -- Gaby _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost