Boost logo

Boost :

Subject: Re: [boost] spoiled function declarations
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2010-05-05 20:56:35


On Wed, May 5, 2010 at 10:24 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> Chad Nelson wrote:
>>
>> On 05/05/2010 09:27 AM, Lorenzo Caminiti wrote:
>>>
>>> I have been looking to which Boost libraries provide an interface that
>>> "spoils" usual C++ function declaration using macros. So far I found
>>> that both Boost.ConceptCheck and Boost.Parameter replace usual C++
>>> function declaration using macros (see sample code below).
>>>
>>> Do you know of any other Boost library that "spoils" usual C++
>>> function declaration?
>>
>> In XInt (not yet an official Boost library), I use macros to define a
>> few fixed_integer operators. Why? Is that a problem?
>
> No.  This is somewhat different because it's an implementation
> detail of your library.

Yes, I am mainly interested in both:
(1) Public APIs of the libraries (i.e., macros called by the library
users directly).
(2) And, macros which only spoil the function declaration signatures
without actually defining the functions.
(I should have clarified these points in my original email...)

Again, BOOST_CONCEPT_REQUIRES() is a perfect example as (1) it is
called by the library user and (2) it only changes the function
declaration signature without defining the function.

On Wed, May 5, 2010 at 10:22 AM, Chad Nelson
<chad.thecomfychair_at_[hidden]> wrote:
> In XInt (not yet an official Boost library), I use macros to define a
> few fixed_integer operators. Why? Is that a problem?

No, it is not a problem. Boost.Contract spoils function declarations
and I am looking to:
1) Allow other libraries that also spoil function declarations to
still use contracts (e.g., allow to use Boost.ContractCheck and
Boost.Parameter together with Boost.Contract).
2) Other examples of spoiled declaration syntax to compare with and
improve Boost.Contract.

On Wed, May 5, 2010 at 10:07 AM, Roland Bock <rbock_at_[hidden]> wrote:
> Not sure if this is what you are looking for, but Boost.Iostreams
> constructs the interface of several classes via macros.
>
> For instance, this (from boost/iostreams/stream.hpp) translates into
> some dozen public member functions:
>
> BOOST_IOSTREAMS_FORWARD( stream, open_impl, Device,
>                             BOOST_IOSTREAMS_PUSH_PARAMS,
>                             BOOST_IOSTREAMS_PUSH_ARGS )

Do users of Boost.Iostreams call this macro directly? If so, this
might be a relevant example of what I am looking for (however, this
seems to not just declare but also define the functions).

Thank you.

-- 
Lorenzo

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk