|
Boost : |
Subject: [boost] [mpl] Strange error using boost::mpl::eval_if
From: Edward Diener (eldiener_at_[hidden])
Date: 2012-11-11 21:13:52
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.
---------------------------------------------------------------
#include <boost/mpl/bool.hpp>
#include <boost/mpl/eval_if.hpp>
template<class T,class C>
struct AAA
{
static const bool value=true;
typedef boost::mpl::bool_<value> type;
};
template<class T>
struct CCC
{
static const bool value=true;
typedef boost::mpl::bool_<value> type;
};
template<class T>
struct BBB :
CCC<T>
{
};
template<class T1,class T2,class T3,class T4>
struct DDD :
boost::mpl::eval_if
<
boost::mpl::false_,
BBB<T1>,
AAA<int,int>
>
{
};
template
<
class T1,
class T2 = int,
class T3 = int,
class T4 = int
>
struct EEE :
DDD<T1,T2,T3,T4>
{
};
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>'
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g
-Wno-variadic-macros -std=c++0x -DBOOST_ALL_NO_LIB=1 -I"..\..\.." -c -o
"..\..\..\bin.v2\libs\tti\test\test_has_mem_fun.test\gcc-mingw-4.6.0\debug\test_has_mem_fun.o"
"test_has_mem_fun.cpp"
-----------------------------------------------------------------------
I must be overlooking something obvious but I cannot see it. Any help
showing me what is wrong would be appreciated.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk