Index: boost/config/suffix.hpp =================================================================== --- boost/config/suffix.hpp (révision 74897) +++ boost/config/suffix.hpp (copie de travail) @@ -688,5 +688,17 @@ #define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST +// BOOST_FORCEINLINE ---------------------------------------------// +// Macro to use in place of 'inline' to force a function to be inline +#if !defined(BOOST_FORCEINLINE) +# if defined(_MSC_VER) +# define BOOST_FORCEINLINE __forceinline +# elif defined(__GNUC__) && __GNUC__ > 3 +# define BOOST_FORCEINLINE inline __attribute__ ((always_inline)) +# else +# define BOOST_FORCEINLINE inline +# endif #endif +#endif + Index: libs/config/doc/macro_reference.qbk =================================================================== --- libs/config/doc/macro_reference.qbk (révision 74897) +++ libs/config/doc/macro_reference.qbk (copie de travail) @@ -889,6 +889,26 @@ used to create a mangled name in combination with a predefined macro such a \_\_LINE__. ]] +[[`BOOST_FORCEINLINE`][ +This macro can be used in place of the `inline` keyword to instruct the compiler +that a function should always be inlined. +Overuse of this macro can lead to significant bloat, while good use can increase +performance in certain cases, such as computation-intensive code built through +generative programming techniques. + +Usage example: +`` + template + BOOST_FORCEINLINE T& f(T& t) + { + return t; + } +`` + +Note that use of this macro can lead to cryptic error messages with some compilers. +Consider defining it to `inline` before including the Boost.Config header in order to be +able to debug errors more easily. +]] ] [endsect]