Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2005-07-02 18:03:27


Tag Types:
----------

The Function Type library uses tag types to represent one more attributive
properties of a type, such as its variadicness or its calling convention.

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 has a
particular value.

     is_function< T, variadic >
     is_function< T, default_call >

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<default_call,variadic>

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

     tag<nonvariadic,variadic> // same as 'variadic'

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

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

All properties not described by the tag acquire a default. The next example
creates the type of a (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 __fastcall (...),tag<variadic,fastcall> >::value // is true
     is_function< void __stdcall (...),tag<variadic,fastcall> >::value // is false

[ version with markup: http://tinyurl.com/bxvke ]


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