Boost logo

Boost :

Subject: Re: [boost] [mpl] is_macro_called
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2010-04-05 12:01:30


Why would it matter if the function is compiled before or after the
class? The preprocessor will expand the counter value to 1 after
PP_UPDATE_COUNTER() at preprocessing time thus regardless of which
order the preprocessed code will actually be compiled.

However, this approach will not work for me because the #include
cannot be programmed within the macro. Therefore, I will have to rely
on the macro callers to explicitly indicate if they are calling the
macro by using the #include...

Is there a way I can do this without using #instructions programmed
outside the macro definition?

Thanks a lot.
Lorenzo

On 4/4/10, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> Lorenzo Caminiti wrote:
>> On Sat, Apr 3, 2010 at 4:44 PM, Steven Watanabe <watanabesj_at_[hidden]>
>> wrote:
>>
>>> How do you prevent someone from defining the member function
>>> out of line? Even if you could do it, it seems prone to subtle bugs.
>>>
>> -
>> I understand but I would be interested in a solution even if it had
>> limitations. In this specific case, even if the solution was to only
>> work when the member function is defined inline within the class, I
>> would still be interested in it.
>>
>> However, even for inlined member functions, personally I could not
>> come up with any code that I can program within the member function
>> definition scope which has an effect that can be inspected at
>> compile-time at the class definition scope...
>
> Even if it could be done on some compilers, it wouldn't be portable
> because there's a good chance that the compiler won't try to compile
> the member functions until it's finished with the class body.
>
> Try compiling this
> class C {
> void f() {
> int i = ::test;
> }
> static const int i = ::test;
> };
>
> The first error is likely to be for the class member rather than
> inside f.
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Sent from my mobile device

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk