Boost logo

Boost :

Subject: Re: [boost] [type_traits] Rewrite and dependency free version
From: Peter Dimov (lists_at_[hidden])
Date: 2015-01-15 13:04:12


> Although, now that I think of it, creating 'void() const' is in principle
> possible in C++03 as well. Not sure what the old type traits did with such
> types.

boost::is_function<void() const> says 0, even in C++11 mode.

#include <boost/type_traits/is_function.hpp>
#include <boost/core/demangle.hpp>
#include <iostream>
#include <typeinfo>

struct X
{
    void f() const {}
};

template< class T > struct Y
{
};

template< class C, class F > void test( F C::* /*pf*/ )
{
    std::cout << boost::core::demangle( typeid( F ).name() ) << std::endl;
    std::cout << boost::core::demangle( typeid( Y<F> ).name() ) <<
std::endl;
    std::cout << boost::is_function< F >::value << std::endl;
}

int main()
{
    test( &X::f );
}


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