I am trying to specialize a metafunction upon a type that has a function pointer as one of its parameters. The code compiles just fine but it will simply not match the type.
#include <iostream>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
template < typename CONT, typename NAME, typename TYPE, TYPE (CONT::*getter)() const, void (CONT::*setter)(TYPE const&) >
struct metafield_fun {};
struct test_field {};
struct test
{
int testing() const { return 5; }
void testing(int const&) {}
};
template < typename T >
struct field_writable : boost::mpl::identity<T> {};
template < typename CONT, typename NAME, typename TYPE, TYPE (CONT::*getter)() const >
struct field_writable< metafield_fun<CONT,NAME,TYPE,getter,0> > : boost::mpl::false_
{};
typedef metafield_fun<test, test_field, int, &test::testing, 0> unwritable;
int main()
{
std::cout << typeid(field_writable<unwritable>::type).name() << std::endl;
std::cin.get();
}
Output is always the type passed in, never bool_.