Boost logo

Boost :

Subject: Re: [boost] [mpl] Strange error using boost::mpl::eval_if
From: Edward Diener (eldiener_at_[hidden])
Date: 2012-11-11 21:55:02


On 11/11/2012 9:21 PM, Steven Watanabe wrote:
> AMDG
>
> On 11/11/2012 06:13 PM, Edward Diener wrote:
>> No doubt I have had some sort of C++ brain blockage but the following
>> code using boost::mpl::eval_if gives an error and I cannot see how this
>> would be. This is a simplified case of a more serious problem.
>>
>> ---------------------------------------------------------------
>>
>> <snip>
>>
>> template<class T1,class T2,class T3,class T4>
>> struct DDD :
>> boost::mpl::eval_if
>> <
>> boost::mpl::false_,
>> BBB<T1>,
>> AAA<int,int>
>> >
>> {
>> };
>>
>> <snip>
>>
>> int main()
>> {
>> bool result = EEE<int,int>::value;
>> return(result ? 1 : 0);
>> }
>>
>> -----------------------------------------------------------------------
>>
>> Compiling with gcc 4.6.0 in MingW under Windows I get:
>>
>> test_has_mem_fun.cpp: In function 'int main()':
>> test_has_mem_fun.cpp:50:17: error: 'value' is not a member of 'EEE<int,
>> int>'
>>
>> <snip>
>>
>> -----------------------------------------------------------------------
>>
>> I must be overlooking something obvious but I cannot see it. Any help
>> showing me what is wrong would be appreciated.
>>
>
> I think you're missing the ::type after eval_if.

I realized not that I was missing ::type directly after eval_if but
after the final expression, which instead of:

bool result = EEE<int,int>::value;

should be

bool result = EEE<int,int>::type::value;

Thanks for waking me up about this.


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