Boost logo

Boost :

Subject: [boost] [function] why do I function1 for type-of emulation?
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-04-10 15:01:54

Hello all,

I was trying to use Boost.Function together with Boost.Typeof. It seems that
if I run in type-of emulation mode I have to register boost::functionN
instead of boost::function even if I only use boost::function... do you know

For example:

#include <boost/function.hpp>
#include <boost/typeof/typeof.hpp>

//BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function, 1) // (1)
BOOST_TYPEOF_REGISTER_TEMPLATE(boost::function1, 2) // (2)

int main() {
    typedef BOOST_TYPEOF(&boost::function<int (int)>::operator()) f;
    return 0;

In order to compile this (on MSVC 8.0 and GCC 4.5.3) with
BOOST_TYPEOF_EMULATION #defined, I have to register boost::function1 as in
line (2) but I'd expect it to work with the registration of boost::function
of line (1) instead.

Why do I have to register boost::function1 (2) instead of boost::function
(1) for type-of emulation?

Thanks a lot.

View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at