|
Boost Users : |
Subject: [Boost-users] [mpl, enable_if] "Failed to specialize function template"
From: Igor R (boost.lists_at_[hidden])
Date: 2010-12-14 10:59:06
Hello,
The following code fails to compile (MSVC10, Boost 1.45) with "error
C2893: Failed to specialize function template..."
It seems that the compiler tries to evaluate mpl::apply, doesn't it?
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/always.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/utility/enable_if.hpp>
using namespace boost::mpl;
using boost::is_same;
template<typename Type>
void test(Type,
typename boost::enable_if
<
and_
<
not_<boost::is_same<Type, int> >,
apply<always<true_>, typename Type::my_type>
>
>::type* dummy = 0)
{
}
template<typename Type>
void test(Type,
typename boost::disable_if
<
and_
<
not_<boost::is_same<Type, int> >,
apply<always<true_>, typename Type::my_type>
>
>::type* dummy = 0)
{
}
int main(int argc, char* argv[])
{
test(int());
return 0;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net