
Hello all, 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? Boost.ConceptCheck: template<typename RanIter> BOOST_CONCEPT_REQUIRES( ((Mutable_RandomAccessIterator<RanIter>)) ((LessThanComparable<typename Mutable_RandomAccessIterator<RanIter>::value_type>)), (void)) // return type within macro instead that before function name stable_sort(RanIter,RanIter) { ... } Boost.Parameter (quite a bit more involved): BOOST_PARAMETER_FUNCTION( (void), // 1. parenthesized return type depth_first_search, // 2. name of the function template tag, // 3. namespace of tag types (required (graph, *) ) // 4. one required parameter, and (optional // four optional parameters, with defaults (visitor, *, boost::dfs_visitor<>()) (root_vertex, *, *vertices(graph).first) (index_map, *, get(boost::vertex_index,graph)) (in_out(color_map), *, default_color_map(num_vertices(graph), index_map) ) ) ) { // ... body of function goes here... // use graph, visitor, index_map, and color_map } Thank you very much. -- Lorenzo

Lorenzo Caminiti wrote:
Hello all,
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).
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 ) Regards, Roland

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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? - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvhfwgACgkQp9x9jeZ9/wRojQCgh+67NmOGszWv2h3qdVtYjMCH CXYAoMXMDcL+y8I95cSvP1WMw5QMEL+F =lDFM -----END PGP SIGNATURE-----

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. In Christ, Steven Watanabe

On Wed, May 5, 2010 at 10:24 AM, Steven Watanabe <watanabesj@gmail.com> 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@gmail.com> 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@eudoxos.de> 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

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?
You might say that enable_if "spoils" function declarations. It can be intrusive, but it's not a macro. Andrew Sutton andrew.n.sutton@gmail.com

----- Original Message ----- From: "Andrew Sutton" <andrew.n.sutton@gmail.com> To: <boost@lists.boost.org> Sent: Thursday, May 06, 2010 4:24 AM Subject: Re: [boost] spoiled function declarations
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?
You might say that enable_if "spoils" function declarations. It can be intrusive, but it's not a macro.
Yes, enable_if can be seen as a way to check concepts, so maybe this should be taken in consideration on Boost.Contract. In the same spirit, you can also consider Boost.CallTraits, but I don't think this will have a repercusion on Boost.Contract, but who knows? Best, Vicente
participants (6)
-
Andrew Sutton
-
Chad Nelson
-
Lorenzo Caminiti
-
Roland Bock
-
Steven Watanabe
-
vicente.botet