Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-07-02 16:19:37


Here we go again. The next update. Big thanks go to Rob Stewart and David Abrahams
for their helping with this text.

There is a version of this passage with markup: http://tinyurl.com/bxvke

Can we freeze this part?

Regards,

Tobias

Tag Types
----------

The Function Type library uses tag types to represent one more properties of a
type, such as its variadicness or whether the function is decorated with a pointer.

Tags that represent the values of a single property are called property tags.
These tags can be used to determine whether one property of a type or another tag
has a particular value.

     is_function< T, variadic >
     is_function< T, pointer >

A compound property tag describes a combination of possible values of different
properties. The tag class template can be used to create a specific compound
property tag.

     tag<pointer,variadic> // describes a pointer to a variadic function

When several tags for the same property appear in the argument list, only the last
one is used; others are ignored.

     tag<pointer,reference> // same as 'reference'

The following code creates the type int(*)(int...).

     function_type<mpl::vector<int,int>, tag<pointer,variadic> >::type

All properties not described by the tag acquire a default. The next example
creates the type of an undecorated (variadic) function of the default calling
convention: int(int...).

     function_type<mpl::vector<int,int>, variadic >::type

A compound property tag matches a type only when all of its component properties
match:

     is_function< void(&)(...) , tag<reference,variadic> >::value // is true
     is_function< void(X::*)(...), tag<reference,variadic> >::value // is false


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