Boost logo

Boost :

Subject: [boost] spoiled function declarations
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2010-05-05 09:27:50


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

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