Subject: Re: [boost] [function] function.hpp lacks include guard
From: Pete Bartlett (pete_at_[hidden])
Date: 2008-10-22 17:17:19


>>Gennaro Prota wrote:
>>>> #ifdef BOOST_FUNCTION_HPP_##BOOST_FUNCTION_MAX_ARGS
>>>> #define BOOST_FUNCTION_HPP_##BOOST_FUNCTION_MAX_ARGS
>>>> ...
>>>> #endif
>>> Clever...
>> Depressing...

>If only it compiled...
>
>In Christ,
>Steven Watanabe

Doubtless I'm more easily impressed than Gennaro, but to me the general idea
of doing only the arities you need to *is* quite clever

Sketch:

#ifndef BOOST_FUNCTION_MAX_ARGS_CURRENTLY_AVAILABLE_PLUS_1
#define BOOST_FUNCTION_MAX_ARGS_CURRENTLY_AVAILABLE_PLUS_1 0
#endif

#if (BOOST_FUNCTION_MAX_ARGS >
BOOST_FUNCTION_MAX_ARGS_CURRENTLY_AVAILABLE_PLUS_1)

//do file iteration from
//BOOST_FUNCTION_MAX_ARGS_CURRENTLY_AVAILABLE_PLUS_1 to
BOOST_FUNCTION_MAX_ARGS

#undef BOOST_FUNCTION_MAX_ARGS_CURRENTLY_AVAILABLE_PLUS_1
#define BOOST_FUNCTION_MAX_ARGS_CURRENTLY_AVAILABLE_PLUS_1
(1+BOOST_FUNCTION_MAX_ARGS) //ready for next include

#endif

I'm not sure how much gain you will see in practice as the inner headers
will themselves already have include guards, but perhaps worth investigating
nonetheless.