Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Macro BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS

BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS — Specify when local functions can be passed as template parameters without introducing any run-time overhead.

Synopsis

// In header: <boost/local_function/config.hpp>

BOOST_LOCAL_FUNCTION_CONFIG_LOCALS_AS_TPARAMS

Description

If this macro is defined to 1, this library will assume that the compiler allows to pass local classes as template parameters:

    template<typename T> void f(void) {}

    int main(void) {
        struct local_class {};
        f<local_class>();
        return 0;
    }

This is the case for C++11 compilers and some C++03 compilers (e.g., MSVC), but it is not the case in general for most C++03 compilers (including GCC). This will allow the library to pass local functions as template parameters without introducing any run-time overhead (specifically without preventing the compiler from optimizing local function calls by inlining their assembly code).

If this macro is defined to 0 instead, this library will introduce a run-time overhead associated to resolving a function pointer call in order to still allow to pass the local functions as template parameters.

It is recommended to leave this macro undefined. In this case, the library will automatically define this macro to 0 if the Boost.Config macro BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS is defined for the specific compiler, and to 1 otherwise.

See: Getting Started section, Advanced Topics section, BOOST_LOCAL_FUNCTION_NAME.


PrevUpHomeNext