# Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-07-04 11:05:26

Vesa,
Does this mean that BOOST_PREPROCESSOR_EQUAL will also make an appearance?
To full MACROize Boost.Function I need something like:

#define ADAPTABLE_BINARY() typedef T0 first_argument_type; \
typedef T1 second_argument_type;
#define
// Later...
BOOST_PREPROCESSOR_IF(BOOST_PREPROCESSOR_EQUAL(1,n),
BOOST_PREPROCESSOR_EMPTY)
BOOST_PREPROCESSOR_IF(BOOST_PREPROCESSOR_EQUAL(2,n),
BOOST_PREPROCESSOR_EMPTY)

Thanks for all your great work on this library.
Doug

On Saturday 30 June 2001 03:46, you wrote:
> Hi,
>
> A few hours ago, I invented a technique for implementing ADD(X,Y) and
> SUB(X,Y) using linear amount of tokens. In other words, code like this does
> what you'd expect:
>
> assert(BOOST_PREPROCESSOR_SUB(10,5) == 5);
>
> The solution is a repetition primitive that repeatedly calls the specified
> macro with the specified parameter (here without the prefix):
>
> #define REPEAT_CALL(N,M,P) REPEAT_CALL_DELAY(N,M,P)
> #define REPEAT_CALL_DELAY(N,M,P) REPEAT_CALL##N(M,P)
> #define REPEAT_CALL0(M,P)
> #define REPEAT_CALL1(M,P) M(P)
> #define REPEAT_CALL2(M,P) M(M(P))
> #define REPEAT_CALL3(M,P) REPEAT_CALL2(M,M(P))
> #define REPEAT_CALL4(M,P) REPEAT_CALL3(M,M(P))
> #define REPEAT_CALL5(M,P) REPEAT_CALL4(M,M(P))
> // ...
>
> In other words, this evaluates to something like:
>
> M(M(M(M(M(M(P))))))
>
> The ADD and SUB primitives are then implemented like this:
>
> BOOST_PREPROCESSOR_REPEAT_CALL(Y,BOOST_PREPROCESSOR_INC,X)
>
> #define BOOST_PREPROCESSOR_SUB(X,Y)\
> BOOST_PREPROCESSOR_REPEAT_CALL(Y,BOOST_PREPROCESSOR_DEC,X)
>
> ...
>
> documentation.
>
> If you want, I can update the library files, so that you can test and try
> the new ADD and SUB primitives.
>
> It is highly likely that other interesting and useful operations could be
> implemented in the future.
>
> -Vesa
>
>
>
> Info: http://www.boost.org Unsubscribe:
> <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
{"ft_lang_label":"__label__en","ft_lang_prob":0.6987132,"math_prob":0.65360373,"size":2401,"snap":"2020-10-2020-16","text_gpt3_token_len":675,"char_repetition_ratio":0.20525657,"word_repetition_ratio":0.0,"special_character_ratio":0.29029572,"punctuation_ratio":0.21609196,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9580626,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-04-05T16:17:51Z\",\"WARC-Record-ID\":\"<urn:uuid:3a740ddb-08d3-4987-9dd6-06bfd635a5c9>\",\"Content-Length\":\"15205\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:af80ec80-918d-4632-9643-dfc303dc71d0>\",\"WARC-Concurrent-To\":\"<urn:uuid:a4aa4d77-79dc-4925-bd64-fc0fe4a5aa9b>\",\"WARC-IP-Address\":\"146.20.110.251\",\"WARC-Target-URI\":\"https://lists.boost.org/Archives/boost/2001/07/14276.php\",\"WARC-Payload-Digest\":\"sha1:XFOV2RVPOSNUK55ZPXUOVJ57ZQN2TKGM\",\"WARC-Block-Digest\":\"sha1:SNUKMAXBDZUADYQTVQGG4BAGNSIJDJGK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-16/CC-MAIN-2020-16_segments_1585371606067.71_warc_CC-MAIN-20200405150416-20200405180916-00533.warc.gz\"}"}